parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Push notifications not being sent

Open SpataTech opened this issue 10 years ago • 8 comments

I don't know if you can help with this at all, but I have not found any solutions for my problem anywhere. I have push notifications set up on parse server with heroku. If I send a push from Parse.com it works, if I try to send the same push form the new dashboard, or from heroku, it doesn't work. I can see the push from the parse.com site as a api call, and it says sent but it isn't really sent.

screen shot 2016-05-18 at 8 35 33 am

this happens for both ios and android. No logs show for anything, I get no error logs, and the new dashboard doesn't receive any from my cloud code. Does anyone know what is wrong, or point me in the right direction, or is this not something with the server?

Check out https://github.com/ParsePlatform/parse-server/issues/1271 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!

Many members of the community use Stack Overflow and Server Fault to ask questions. Read through the existing questions or ask your own!

  • Stack Overflow: http://stackoverflow.com/questions/tagged/parse.com
  • Server Fault: https://serverfault.com/tags/parse

For database migration help, please file a bug report at https://parse.com/help#report

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

  • [x] You've met the prerequisites: https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#prerequisites.
  • [x] You're running the latest version of Parse Server: https://github.com/ParsePlatform/parse-server/releases
  • [x] You've searched through existing issues: https://github.com/ParsePlatform/Parse-Server/issues?utf8=%E2%9C%93&q=is%3Aissue Chances are that your issue has been reported or resolved before.

Environment Setup

  • Server: parse-server version, operating system, hardware, local or remote? Latest version, OS X, remote(heroku).

  • Database: version, storage engine, hardware, local or remote? Mongolab, remote.

    Steps to reproduce

    I followed the guide to set up push notifications.

  • Can this issue be reproduced using the Parse Server REST API? Include curl commands when applicable. yes.

  • What was the expected result? What is the actual outcome?

Logs/Trace

  • You can turn on additional logging by configuring VERBOSE=1 in your environment.

The only thing I get from this is this line: error: error while sending push code=107, message=You cannot use [object Object] as a query parameter.

This is the code I am using to send the push notification:

var pushQuery = new Parse.Query(Parse.Installation); pushQuery.equalTo("user", "userId"); Parse.Push.send({ where: {pushQuery}, data:{ "title": "testing!", "alert": "New Server Test " } },{ success: function(){ console.log("push: " + "Sent successfully"); }, error: function(error){ console.log("error: " + error); }, useMasterKey: true });

It will return successful in the code, but fail to send.

SpataTech avatar May 18 '16 15:05 SpataTech

Can you fill out the details in the bug report under Environment Setup, Steps to reproduce, and Logs/Trace?

hramos avatar May 18 '16 19:05 hramos

Looks like you simply should remove the curly braces around pushQuery in your call, not sure why you added them there..

where: pushQuery not where: {pushQuery}

bohemima avatar May 19 '16 06:05 bohemima

Thank you, I can't believe I missed that. After doing that the error goes away. Now if I try to push to iOS I get: ERR! parse-server-push-adapter APNS cannot find vaild connection for "devicetoken". When I try to push to android it says it was sent but it never pushes it out to a device.

SpataTech avatar May 19 '16 15:05 SpataTech

i have the same problem.

here is my nodejs log:

verbose: POST /parse/push { host: 'x', 'x-real-ip': 'x', 'x-forwarded-for': 'x', 'content-length': '256', accept: '/', 'content-type': 'text/plain', 'user-agent': 'node-XMLHttpRequest, Parse/js1.8.5 (NodeJS 4.4.3)', 'x-forwarded-port': '80', 'x-forwarded-proto': 'http' } { "where": {}, "data": { "data": { "alert": "admin", "file": "" } } } verbose: { "headers": { "X-Parse-Push-Status-Id": "DM04nXMvPI" }, "response": { "result": true } }

verbose: sending push to 2 installations verbose: sent push! 2 success, 0 failures

Looking at the _PushStatus table, here is the relevant push record:

"_id": "DM04nXMvPI",
"_rperm": [],
"_wperm": [],
"_acl": {},
"_created_at": {
    "$date": "2016-05-23T11:54:04.834Z"
},
"pushTime": "2016-05-23T11:54:04.834Z",
"query": "{}",
"payload": "{\"data\":{\"alert\":\"admin\",\"file\":\"\"}}",
"source": "rest",
"status": "succeeded",
"numSent": 2,
"pushHash": "a376ff2924565fc325777a0ced4ef265",
"_updated_at": {
    "$date": "2016-05-23T11:54:04.953Z"
},
"numFailed": 0,
"sentPerType": {
    "android": 2
}

logs says the push was sent but I dont receive any on my android device. I dont know what to do next to resolve this...

allanascano-otus avatar May 23 '16 12:05 allanascano-otus

I switched to using One Signal for my push notifications. It works with that as soon as a device is registered with it.

SpataTech avatar May 23 '16 20:05 SpataTech

Seems that there is a problem in your configuration, but as you switched to OneSignal, we can't really drill it down.

Closing for now. If the problem persists, please re-open on parse-server-push-adapter.

flovilmart avatar Jun 05 '16 17:06 flovilmart

2017-05-03T15:20:13.077422+00:00 app[web.1]: info: Ran cloud function pushmess for user xxxxx with: 2017-05-03T15:20:13.077427+00:00 app[web.1]: Input: {"toEmail":"[email protected]"} 2017-05-03T15:20:13.077429+00:00 app[web.1]: Result: "Push Sent!" functionName=push, [email protected], user=xxxx 2017-05-03T15:20:13.079023+00:00 heroku[router]: at=info method=POST path="/parse/functions/pushmess" host=appname.herokuapp.com request_id=cc36123f-18af-416f-9ead-d6cb049c816f fwd="183.82.109.220" dyno=web.1 connect=1ms service=535ms status=200 bytes=505 protocol=https 2017-05-03T15:20:13.070442+00:00 heroku[router]: at=info method=POST path="/parse/push" host=appname.herokuapp.com request_id=98507ee2-e144-4cd6-b278-72d2de89ba7c fwd="54.242.173.91" dyno=web.1 connect=0ms service=44ms status=200 bytes=533 protocol=https 2017-05-03T15:20:13.369393+00:00 heroku[router]: at=info method=POST path="/parse/classes/xxxxx" host=appname.herokuapp.com request_id=37e0f7ad-0ff8-4412-9c28-67f150aa1c17 fwd="183.82.109.220" dyno=web.1 connect=1ms service=112ms status=200 bytes=532 protocol=https

but i didn't receive push notification on device.

wellkeptbeauty avatar May 03 '17 16:05 wellkeptbeauty

Have a look into the guide on https://docs.parseplatform.org/parse-server/guide and doublecheck your configurations

flovilmart avatar May 06 '17 15:05 flovilmart