Skip to content

Push Notification not sending properly after updating to 2.6.2 #4256

Closed

Description

@rynrn

Issue Description

I'm trying to sending a push after the update from 2.3.1 to 2.6.2, but the push not sent properly.
I have many channels to send them push, but from some reason when i'm sanding the push from the dashboard it's send ok but from code the push not send all the time.

Expected Results

The push gets sent to all users.

Actual Outcome

The push notification does not get sent all the time (looks like it's sent only to the small channels, but not sure about it)

Environment Setup

  • parse-server version : 2.6.2
  • Heroku (1 Web Dyno: 1x)

My parse-server push configuration is as follows:

var api = new ParseServer({
  databaseURI: databaseUri,
  cloud: path.join(__dirname, '/cloud/main.js'),
  appId: appId,
  masterKey: masterKey,
  javascriptKey: javascriptKey,
  clientKey: clientKey,
  serverURL: serverURL, 
  liveQuery: {
    classNames: ["Chat"] 
  },
  push: {
    android: {
      senderId: 'XYZ',
      apiKey: 'XYZ'
    },
    ios: [{
      pfx: path.join(__dirname, '../cert/fc_maccabi.p12'),
      topic: 'com.macabihaifa',
      production: true
    },
    {
      pfx: path.join(__dirname, '../cert/fc_tel_aviv.p12'),
      topic: 'com.telaviv',
      production: true
    },
    {
      pfx: path.join(__dirname, '../cert/fc_barcelona.p12'),
      topic: 'com.fcbarcelona',
      production: true
    }]
  }
});

Push Code

Parse.Push.send({
    where: {
      "channels": channel,
      "deviceType": { "$in": [ "ios",  "android"  ]  }
    },
    data: {
      message: message,
      title:   title,
      alert:   alert,
      sound:   sound
    }
  }, {  useMasterKey: true });

Logs/Trace

2017-10-15T10:05:18.309363+00:00 app[web.1]: �[36mverbose�[39m: REQUEST for [POST] /parse/push: {
2017-10-15T10:05:18.309366+00:00 app[web.1]:   "where": {
2017-10-15T10:05:18.309367+00:00 app[web.1]:     "channels": "GDmBotGf9h-news",
2017-10-15T10:05:18.309367+00:00 app[web.1]:     "deviceType": {
2017-10-15T10:05:18.309368+00:00 app[web.1]:       "$in": [
2017-10-15T10:05:18.309368+00:00 app[web.1]:         "ios",
2017-10-15T10:05:18.309369+00:00 app[web.1]:         "android"
2017-10-15T10:05:18.309369+00:00 app[web.1]:       ]
2017-10-15T10:05:18.309370+00:00 app[web.1]:     }
2017-10-15T10:05:18.309370+00:00 app[web.1]:   },
2017-10-15T10:05:18.309371+00:00 app[web.1]:   "data": {
2017-10-15T10:05:18.309374+00:00 app[web.1]:     "message": "{[some str]}",
2017-10-15T10:05:18.309375+00:00 app[web.1]:     "title": "title",
2017-10-15T10:05:18.309376+00:00 app[web.1]:     "alert": "alert",
2017-10-15T10:05:18.309376+00:00 app[web.1]:     "sound": "default"
2017-10-15T10:05:18.309377+00:00 app[web.1]:   }
2017-10-15T10:05:18.309379+00:00 app[web.1]: } method=POST, url=/parse/push, host=app.herokuapp.com, connection=close, user-agent=node-XMLHttpRequest, Parse/js1.8.5 (NodeJS 8.7.0), accept=*/*, content-type=text/plain, x-request-id=ed0a3b04-7b4f-464e-bb16-1e276af7afaa, x-forwarded-for=[someIP], x-forwarded-proto=https, x-forwarded-port=443, via=1.1 vegur, connect-time=0, x-request-start=1508061918310, total-route-time=0, content-length=1411, channels=GDmBotGf9h-news, $in=[ios, android], message={[some str]}, title=title, alert=alert, sound=default
2017-10-15T10:05:18.314153+00:00 app[web.1]: �[36mverbose�[39m: RESPONSE from [POST] /parse/push: {
2017-10-15T10:05:18.314155+00:00 app[web.1]:   "headers": {
2017-10-15T10:05:18.314156+00:00 app[web.1]:     "X-Parse-Push-Status-Id": "mvTTnyUEMV"
2017-10-15T10:05:18.314156+00:00 app[web.1]:   },
2017-10-15T10:05:18.314157+00:00 app[web.1]:   "response": {
2017-10-15T10:05:18.314157+00:00 app[web.1]:     "result": true
2017-10-15T10:05:18.314158+00:00 app[web.1]:   }
2017-10-15T10:05:18.314158+00:00 app[web.1]: } X-Parse-Push-Status-Id=mvTTnyUEMV, result=true
2017-10-15T10:05:18.422696+00:00 app[web.1]: �[36mverbose�[39m: _PushStatus mvTTnyUEMV: sending push to 4604 installations
2017-10-15T10:05:18.319791+00:00 heroku[router]: at=info method=POST path="/parse/push" host=app.herokuapp.com request_id=ed0a3b04-7b4f-464e-bb16-1e276af7afaa fwd="[someIP]" dyno=web.1 connect=0ms service=7ms status=200 bytes=533 protocol=https
2017-10-15T10:05:18.247501+00:00 heroku[router]: at=info method=POST path="/parse/classes/Post" host=app.herokuapp.com request_id=688db96d-04d6-4d04-88e8-f77ee3630fb9 fwd="[someIP]" dyno=web.1 connect=0ms service=60ms status=200 bytes=1443 protocol=https
2017-10-15T10:05:18.152392+00:00 heroku[router]: at=info method=POST path="/parse/classes/App" host=app.herokuapp.com request_id=426f4f04-bd1d-4355-bebc-4b73fd877187 fwd="[someIP]" dyno=web.1 connect=1ms service=12ms status=200 bytes=3087 protocol=https
2017-10-15T10:05:18.244063+00:00 heroku[router]: at=info method=POST path="/parse/classes/Post" host=app.herokuapp.com request_id=5a998000-70b8-4356-bba1-1f9a5a09cf22 fwd="[someIP]" dyno=web.1 connect=0ms service=58ms status=200 bytes=537 protocol=https
2017-10-15T10:05:18.143866+00:00 heroku[router]: at=info method=POST path="/parse/classes/App" host=app.herokuapp.com request_id=4a5050e8-59a4-4dcf-9168-1ff3098412ba fwd="[someIP]" dyno=web.1 connect=0ms service=10ms status=200 bytes=3087 protocol=https
2017-10-15T10:05:18.147909+00:00 heroku[router]: at=info method=POST path="/parse/classes/App" host=app.herokuapp.com request_id=2861c69d-ff66-4003-95e1-8c684fe4f240 fwd="[someIP]" dyno=web.1 connect=0ms service=12ms status=200 bytes=3087 protocol=https
2017-10-15T10:05:18.282397+00:00 heroku[router]: at=info method=POST path="/parse/classes/Post" host=app.herokuapp.com request_id=89c547e5-281e-4729-bf0b-e09b42c800fc fwd="[someIP]" dyno=web.1 connect=0ms service=17ms status=201 bytes=630 protocol=https
2017-10-15T10:05:18.222299+00:00 heroku[router]: at=info method=POST path="/parse/classes/Post" host=app.herokuapp.com request_id=d609b402-fdd6-486d-997f-2823f6bba8e7 fwd="[someIP]" dyno=web.1 connect=0ms service=36ms status=200 bytes=2500 protocol=https
2017-10-15T10:05:18.155362+00:00 heroku[router]: at=info method=POST path="/parse/classes/App" host=app.herokuapp.com request_id=57e60997-ae78-4b9c-a32e-a4522ec56336 fwd="[someIP]" dyno=web.1 connect=0ms service=14ms status=200 bytes=537 protocol=https
2017-10-15T10:05:18.562016+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.562125+00:00 app[web.1]: (node:30) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2017-10-15T10:05:18.578006+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.586214+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.593721+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.600544+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.613728+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.730708+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.739789+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.748982+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 9): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.293464+00:00 heroku[router]: at=info method=POST path="/parse/classes/Post" host=app.herokuapp.com request_id=87b064d2-06de-4e1d-801c-88245661275e fwd="[someIP]" dyno=web.1 connect=0ms service=25ms status=201 bytes=630 protocol=https
2017-10-15T10:05:18.823380+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 10): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.880201+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 11): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.906608+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 12): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.919578+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 13): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:18.949226+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM sending to 4 devices
2017-10-15T10:05:18.978211+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 14): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.004644+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 15): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.040848+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 16): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.052464+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM GCM Response: {
2017-10-15T10:05:19.052600+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM     "multicast_id": 7522114254235862000,
2017-10-15T10:05:19.052737+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM     "success": 3,
2017-10-15T10:05:19.052872+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM     "failure": 1,
2017-10-15T10:05:19.053006+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM     "canonical_ids": 0,
2017-10-15T10:05:19.053141+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM     "results": [
2017-10-15T10:05:19.053288+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM         {
2017-10-15T10:05:19.053443+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM             "message_id": "0:1508061919015125%689d91a0f9fd7ecd"
2017-10-15T10:05:19.053577+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM         },
2017-10-15T10:05:19.053710+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM         {
2017-10-15T10:05:19.053845+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM             "message_id": "0:1508061918998616%689d91a0f9fd7ecd"
2017-10-15T10:05:19.053977+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM         },
2017-10-15T10:05:19.054994+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM         {
2017-10-15T10:05:19.055113+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM             "error": "NotRegistered"
2017-10-15T10:05:19.055247+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM         },
2017-10-15T10:05:19.055368+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM         {
2017-10-15T10:05:19.055488+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM             "message_id": "0:1508061919000392%689d91a0f9fd7ecd"
2017-10-15T10:05:19.055606+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM         }
2017-10-15T10:05:19.055741+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM     ]
2017-10-15T10:05:19.055860+00:00 app[web.1]: node-pre-gyp verb parse-server-push-adapter GCM }
2017-10-15T10:05:19.056601+00:00 app[web.1]: �[36mverbose�[39m: _PushStatus mvTTnyUEMV: sent push! 3 success, 1 failures
2017-10-15T10:05:19.066173+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 17): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.204535+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 18): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.220096+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 19): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.248703+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 20): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.255125+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 21): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.317957+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 22): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.326887+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 23): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.367350+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 24): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.423710+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 25): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.512048+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 26): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.581548+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 27): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.589316+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 28): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.650941+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 29): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.662505+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 30): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.677212+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 31): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.713900+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 32): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.812058+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 33): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.822004+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 34): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.855353+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 35): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.868349+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 36): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.880841+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 37): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.938792+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 38): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:19.977366+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 39): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:20.102068+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 40): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:20.160002+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 41): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:20.238808+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 42): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:20.243957+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 43): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:20.249829+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 44): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:20.290902+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 45): TypeError: notification.setAlertTitle is not a function
2017-10-15T10:05:20.384966+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 46): TypeError: notification.setAlertTitle is not a function

Activity

  1. agwl-saurabh commented on Oct 14, 2017

    @agwl-saurabh

    please follow proper template and provide full info in template and provide all logs.

  2. rynrn commented on Oct 15, 2017

    @rynrn
    Author

    I updated the issue, it's ok?

  3. adammlevy commented on Oct 16, 2017

    @adammlevy
    Contributor

    According to #4015 the Push format should be as follows:

    data: {
            alert: {title : "My Title",
                      body: "Body Of Alert"}
            }
    

    So in your send the push like this

    Parse.Push.send({
        where: {
          "channels": channel,
          "deviceType": { "$in": [ "ios",  "android"  ]  }
        },
        data: {
          alert: {title: title, body: message},
          sound:   sound
        }
      }, {  useMasterKey: true });
    
  4. rynrn commented on Oct 19, 2017

    @rynrn
    Author

    your solution not working well.
    i will wait to for update

  5. flovilmart commented on Oct 23, 2017

    @flovilmart
    Contributor

    We updated parse-server-push-adapter to the latest version, this will be part of next release.

  6. jeffreyjackson commented on Oct 23, 2017

    @jeffreyjackson

    hey @flovilmart are you saying this will be updated in 2.6.4?

  7. flovilmart commented on Oct 23, 2017

    @flovilmart
    Contributor
  8. dongalor commented on Nov 2, 2017

    @dongalor

    i have upgraded to 2.6.5

    0|parse-wr | verbose: _PushStatus n59yItvDR0: sending push to 1 installations
    0|parse-wr | verbose: Sending push to 1
    0|parse-wr | verbose: _PushStatus n59yItvDR0: sent push! 0 success, 1 failures
    0|parse-wr | verbose: _PushStatus n59yItvDR0: needs cleanup devicesToRemove=[]

    is it the same issue?

    what is needs cleanup devicesToRemove?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions