parse-server: WARNING, Unable to connect to 'https://myurl/myserver'. Cloud code and push notifications may be unavailable!
Issue Description
When I launch my parse server I got a warning WARNING, Unable to connect to ‘https://my.url/myserver/’. Cloud code and push notifications may be unavailable!
But my server is running, I can see datas, edit and read them in my parse dashboard and console.log put in cloud code file works.
I don’t use push notification so I can’t test them…
A precision, I change the domain name recently and change from a self signed certificate (letsencrypt) to a commercial certificate.
But every configuration linked to the old domain has been deleted in nginx and in every files linked to parse (I think so…)
I launch my parse server with pm2 and ecosystem.json :
{
"apps" : [{
"name" : "parse-wrapper",
"script" : "server.js",
"watch" : false,
"merge_logs" : true,
"cwd" : "/home/parse"
}]
}
and server.js :
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');
var app = express();
var api = new ParseServer({
databaseURI: 'mongodb://user:pwd@my.url:mgport/ddb?ssl=true',
cloud: '/home/parse/cloud/main.js',
verbose: true,
appId: 'xxx',
masterKey: 'xxx',
restApiKey:'xxx',
javascriptKey:'xxx',
clientKey:'xxx',
fileKey: 'xxx',
serverURL: 'https://my.url/parse/',
liveQuery: {
classNames: ['MyClass']
}
});
app.use('/parse/', api);
var port = process.env.PORT || 1337;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
console.log('parse-server running on port ' + port + '.');
ParseServer.createLiveQueryServer(httpServer);
});
EDIT : I fix the issue by using http instead of https in the serverURL parameter and using localhost instead of the domain url, but I don’t understand why, it was working before with https with my old domain name
serverURL: 'http://localhost:1337/parse/'
Steps to reproduce
launch the server task with PM2
Expected Results
No warning…
Actual Outcome
get a warning
Environment Setup
-
Server
- parse-server version (Be specific! Don’t say ‘latest’.) : 2.7.1
- Operating System: Ubuntu 14.04 nvm & node 9.4.0
- Hardware: DigitalOcean 1GB Memory
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): DigitalOcean
-
Database
- MongoDB version: 3.0.15
- Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): DigitalOcean
Logs/Trace
WARNING, Unable to connect to ‘https://my.url/myserver/’. Cloud code and push notifications may be unavailable!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (4 by maintainers)
Well when this happens, spend whole day and night debugging it. Cry for sometime thinking you are failure and finally give up and go to sleep. Next day reboot the system it will work properly . Worked for me, not sure about others
I faced this issue and this might help someone in the future.
Note that this is one of the reasons why this warning might be thrown. This is for parse server version: 2.8.2
To create your own standalone parse server, using express, the basic steps involved are close to:
As soon as the mount is called, the parse-server will verify the url mentioned in the config by making a request to /health endpoint.
If for some reason there is a delay in listening to the port (point 6) after mounting the API (point 4), then the above warning will be thrown.
For example, in one case I was establishing a mongoose connection and only then started listening to the port. Because of this, the verification of URL from parse server failed, although everything worked fine after that.
And one of the possible solutions is to get done with all such work before mounting the Parse API and ensuring no delay between mounting and listening to the port as described above.
While this may not be the exact steps for everyone the idea is that:
parse server will call verify URL on the server URL mentioned in the configs.
And if there is a delay in starting the server after you have mounted the parse Apis, the above warning will be thrown.
Hope it helps.
I find my error… It was a wrong ssl setup. I forgot to make a bundle certificate… Everything work perfectly now. Sorry for the wasting time
I don’t know if it’s a consequence but I can’t connect to the parse server form nodejs.
It works fine with CURL or with the dashboard API Console… Any idea?
I have this issue too. Seem come from src/ParseServer.js#L267. My
localhost/health
and<reverseProxyUrl>/health
responses are httpCode:200
and body{"status":"ok"}