Parse-server: Received an error with invalid JSON from Parse: Cannot POST /push\n Error code 107

Created on 2 Apr 2016  Â·  8Comments  Â·  Source: parse-community/parse-server

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!

Environment Setup

Every thing okay, except push notification.

Steps to reproduce

screen shot 2016-04-02 at 3 43 00 pm

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...

Most helpful comment

It's resolved, Thank @flovilmart.

I had used https://**.herokuapp.com instead of https://**.herokuapp.com/parse

All 8 comments

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

Uploading Screen Shot 2016-04-03 at 11.33.12 PM.png…
@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.com instead of https://**.herokuapp.com/parse

Hi hafizapp,
After changing the url i am still facing the same issue, could you help??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ugo-geronimo picture ugo-geronimo  Â·  3Comments

carjo422 picture carjo422  Â·  3Comments

sanergulec picture sanergulec  Â·  4Comments

kilabyte picture kilabyte  Â·  4Comments

lorki picture lorki  Â·  3Comments