Received an error with invalid JSON from Parse: Cannot POST /push\n Error code 107
Check out this issue for an ideal bug report. The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!
For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.
Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!
- [x] You've met the prerequisites.
- [x] You're running the latest version of Parse Server.
- [x] You've searched through existing issues. Chances are that your issue has been reported or resolved before.
Environment Setup
Every thing okay, except push notification.
Steps to reproduce
main.js -->
Parse.Cloud.define("sendPush", function(request, response) {
var sendUserId = request.params.userId;
var msg = request.params.message;
var query = new Parse.Query(Parse.Installation);
query.equalTo('userId', sendUserId);
Parse.Push.send({
query: query,
data: {
alert: msg,
sound: 'default'
}
}, {
success: function() {
// Push was successful
response.success("Push sent");
},
error: function(error) {
// Handle error
response.error(error);
},
useMasterKey: true
});
});
index.js -->
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || '',
masterKey: process.env.MASTER_KEY || '',
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',
push: {
android: {
senderId: 'my id',
apiKey: 'my apiKey'
},
ios: [{
pfx: '/push/Certificates_Dev.p12', // Dev PFX or P12
bundleId: 'my_bundle_id',
production: false // Dev
},
{
pfx: '/push/Certificates_Prod.p12', // prod PFX or P12
bundleId: 'my_bundle_id',
production: true // Prod
}]
}
});
Logs/Trace
Please help...
Can you run parse-server with environment variable VERBOSE=1 in order to get the request/response content?
Also can you try replacing response.success("Push sent"); by response.success();
@flovilmart Just tried by replacing response.success("Push sent"); by response.success();
and same error got.
[Error]: { code = 107; message = "Received an error with invalid JSON from Parse: Cannot POST /push\n"; } (Code: 141, Version: 1.12.0)
I have also added the environment variable VERBOSE=1, how can I see the debug log.
the debug logs should be printed in the console when you server runs; what's the serverURL value? seems related to #1337 somehow
@flovilmart
Except push notifications, all other things working cool.
Server URL should be https://****.herokuapp.com/parse or https://****.herokuapp.com ?
No, the serverURL should be the local loop with http://localhost:PORT/parse, but it could work with the publicly accessible URL
It's resolved, Thank @flovilmart.
I had used https://**.herokuapp.com instead of https://**.herokuapp.com/parse
It's resolved, Thank @flovilmart.
I had used
https://**.herokuapp.cominstead ofhttps://**.herokuapp.com/parse
Hi hafizapp, After changing the url i am still facing the same issue, could you help??