-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
Hi all,
I have continued playing around with Parse Server before pushing it into any of our production apps, today I decided to enable SSL on Heroku using the SSL and ExpeditedSSL add-ons. So far so good, all the regular https:// pages appear to work just fine! I'm using the express-sslify npm module to enforce SSL connections using app.use(enforce.HTTPS({ trustProtoHeader: true })); (see Reverse Proxy section).
However, when calling a Cloud Code function from within an Express route, the server crashes with:
{"code":141,"message":{"code":107,"message":"Received an error with invalid JSON from Parse: Please use HTTPS when submitting data to this server."}}
I have already configured serverURL in the ParseServer constructor to point to the https:// version of my domain (e.g. new Parsehttps://www.mydomain.com/parse) and any client-side JavaScript code is also pointing to the https:// version. I'm actually calling Parse.Cloud.run from within Node.js itself on an Express route; do I need to make any tweaks to Parse for this use case?
E.g. (routes/pages.js):
// Call Parse to get latest trending minecraft skins from the server and feed them to ejs
router.get('/skins', function(req, res, next) {
Parse.Cloud.run('getSkins', { filter:'trending' }, {
success: function(skins) {
res.render('skins/index', {skins:skins});
},
error: function(err) {
res.render('general/error', {error:err});
}
});
});
Heroku Logs:
2016-02-19T14:02:46.419203+00:00 heroku[web.1]: Process exited with status 1
2016-02-19T14:02:49.938374+00:00 app[web.1]: > [email protected] start /app
2016-02-19T14:02:49.938376+00:00 app[web.1]: > node index.js
2016-02-19T14:02:49.938376+00:00 app[web.1]:
2016-02-19T14:09:41.449027+00:00 app[web.1]: Error calling CloudCode function! Err dump: {"code":107,"message":"Received an error with invalid JSON from Parse: Please use HTTPS when submitting data to this server."}
2016-02-19T14:09:41.466799+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-02-19T14:09:41.466972+00:00 app[web.1]: npm ERR! node v5.6.0
2016-02-19T14:09:41.467521+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-02-19T14:09:41.467645+00:00 app[web.1]: npm ERR! [email protected] start: `node index.js`
2016-02-19T14:09:41.468104+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-02-19T14:09:41.468856+00:00 app[web.1]: npm ERR! npm bugs parse-server-example
2016-02-19T14:09:42.090687+00:00 heroku[web.1]: Process exited with status 1
2016-02-19T14:09:42.184401+00:00 heroku[web.1]: State changed from up to crashed
With VERBOSE=1 set, this is the logging:
2016-02-19T14:39:28.590401+00:00 app[web.1]: POST /parse/functions/getSkins { host: 'www.mydomain.com',
2016-02-19T14:39:28.590432+00:00 app[web.1]: via: '1.1 vegur',
2016-02-19T14:39:28.901806+00:00 app[web.1]: error: ParseError {
2016-02-19T14:39:28.901809+00:00 app[web.1]: code: 141,
2016-02-19T14:39:28.901810+00:00 app[web.1]: message:
2016-02-19T14:39:28.901810+00:00 app[web.1]: ParseError {
2016-02-19T14:39:28.901811+00:00 app[web.1]: code: 107,
2016-02-19T14:39:28.901812+00:00 app[web.1]: message: 'Received an error with invalid JSON from Parse: Please use HTTPS when submitting data to this server.' } }