Skip to content

Parse Push to iOS hanging in parse-server 2.5.3 #4015

Closed

Description

@jeremycove

Issue Description

When sending a push from Cloud Code in 2.5.3, the notification seems to hang while being sent. On the Dashboard, the status of the push remains as sending. With VERBOSE=1, the logs don't show anything beyond the "sending push to X installations" step. No push notification is received on the device. Pushes seem to be working fine on Android/GCM.

This is not an issue in 2.4.2 for me, and only occurs when I upgrade to 2.5.3.

Steps to reproduce

I am running a simple Cloud Code function that sends a push notification to a single installation:

Parse.Cloud.define("testPush", function(request, response) {
  Parse.Push.send({
    channels: [ USER_CHANNEL ],
    expiration_interval: 15,
    data: {
      alert: request.params.message,
      title: "GreatApp"
    }
  }, {
    useMasterKey: true
  }).then(function()  {
    response.success("OK");
  });
});

My parse-server push configuration is as follows:

  push: {
    android: {
      senderId: 'XYZ',
      apiKey: 'XYZ'
    },
    ios: [
      {
        pfx: __dirname + '/certs/prod.p12',
        bundleId: 'com.GreatApp',
        production: true
      },
      {
        pfx: __dirname + '/certs/dev.p12',
        bundleId: 'com.GreatApp',
        production: false
      }
    ]
  },

Environment Setup

  • Server
    • parse-server version: 2.5.3
    • Heroku

Logs/Trace

On parse-server 2.4.2, the push is received on my iOS device:

12:18:30 web.1   |  verbose: REQUEST for [POST] /parse/push: {
12:18:30 web.1   |    "channels": [
12:18:30 web.1   |      "user_xyz"
12:18:30 web.1   |    ],
12:18:30 web.1   |    "data": {
12:18:30 web.1   |      "alert": "This is a push!",
12:18:30 web.1   |      "title": "GreatApp"
12:18:30 web.1   |    },
12:18:30 web.1   |    "expiration_interval": 15
12:18:30 web.1   |  } method=POST, url=/parse/push, user-agent=node-XMLHttpRequest, Parse/js1.9.2 (NodeJS 5.12.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=307, connection=close, channels=[user_xyz], alert=This is a push!, title=GreatApp, expiration_interval=15
12:18:30 web.1   |  verbose: RESPONSE from [POST] /parse/push: {
12:18:30 web.1   |    "headers": {
12:18:30 web.1   |      "X-Parse-Push-Status-Id": "kdst8cZERc"
12:18:30 web.1   |    },
12:18:30 web.1   |    "response": {
12:18:30 web.1   |      "result": true
12:18:30 web.1   |    }
12:18:30 web.1   |  } X-Parse-Push-Status-Id=kdst8cZERc, result=true
12:18:30 web.1   |  info: Ran cloud function testPush for user XYZ with:
12:18:30 web.1   |    Input: {"message":"This is a push!"}
12:18:30 web.1   |    Result: "OK" functionName=testPush, message=This is a push!, user=XYZ
12:18:30 web.1   |  verbose: RESPONSE from [POST] /parse/functions/testPush: {
12:18:30 web.1   |    "response": {
12:18:30 web.1   |      "result": "OK"
12:18:30 web.1   |    }
12:18:30 web.1   |  } result=OK
12:18:30 web.1   |  verbose: _PushStatus kdst8cZERc: sending push to 1 installations
12:18:30 web.1   |  verb
12:18:30 web.1   |  parse-server-push-adapter APNS
12:18:30 web.1   |   APNS Connection 0 Connected
12:18:30 web.1   |  verb
12:18:30 web.1   |   parse-server-push-adapter APNS APNS Connection 0 Notification transmitted to 5c1...(device token)
12:18:30 web.1   |  verbose: _PushStatus kdst8cZERc: sent push! 0 success, 0 failures

On parse-server 2.5.3, the push is not received:

12:22:56 web.1   |  verbose: REQUEST for [POST] /parse/push: {
12:22:56 web.1   |    "channels": [
12:22:56 web.1   |      "user_xyz"
12:22:56 web.1   |    ],
12:22:56 web.1   |    "data": {
12:22:56 web.1   |      "alert": "This is a push!",
12:22:56 web.1   |      "title": "GreatApp"
12:22:56 web.1   |    },
12:22:56 web.1   |    "expiration_interval": 15
12:22:56 web.1   |  } method=POST, url=/parse/push, user-agent=node-XMLHttpRequest, Parse/js1.10.0 (NodeJS 5.12.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=308, connection=close, channels=[user_xyz], alert=This is a push!, title=GreatApp, expiration_interval=15
12:22:56 web.1   |  verbose: RESPONSE from [POST] /parse/push: {
12:22:56 web.1   |    "headers": {
12:22:56 web.1   |      "X-Parse-Push-Status-Id": "nOEjLtSWcO"
12:22:56 web.1   |    },
12:22:56 web.1   |    "response": {
12:22:56 web.1   |      "result": true
12:22:56 web.1   |    }
12:22:56 web.1   |  } X-Parse-Push-Status-Id=nOEjLtSWcO, result=true
12:22:56 web.1   |  info: Ran cloud function testPush for user XYZ with:
12:22:56 web.1   |    Input: {"message":"This is a push!"}
12:22:56 web.1   |    Result: "OK" functionName=testPush, message=This is a push!, user=XYZ
12:22:56 web.1   |  verbose: RESPONSE from [POST] /parse/functions/testPush: {
12:22:56 web.1   |    "response": {
12:22:56 web.1   |      "result": "OK"
12:22:56 web.1   |    }
12:22:56 web.1   |  } result=OK
12:22:56 web.1   |  verbose: _PushStatus nOEjLtSWcO: sending push to 1 installations

Activity

  1. jeffreyjackson commented on Jul 14, 2017

    @jeffreyjackson

    I'm experiencing the same issue

  2. jeffreyjackson commented on Jul 14, 2017

    @jeffreyjackson

    I can confirm this. I reverted back to the 2.4.2 and I am now receiving push notifications like I used to.

  3. nathan-charles commented on Jul 14, 2017

    @nathan-charles

    It's something to do with the title property. I commented that out and push is working again on 2.5.3

  4. flovilmart commented on Jul 14, 2017

    @flovilmart
    Contributor

    What title property?

  5. dplewis commented on Jul 14, 2017

    @dplewis
    Member

    https://github.com/parse-server-modules/parse-server-push-adapter/blob/02bfda8c78f783a5bf8d4562fcafd15c9ef577c6/src/APNS.js#L181

    Shouldn't this be setTitle instead of setAlertTitle

    info: Ran cloud function sendPushToUsers for user undefined with:
      Input: {"name":"value"}
      Result: "Push was sent successfully." functionName=sendPushToUsers, name=value, user=undefined
    (node:42607) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): 
    TypeError: notification.setAlertTitle is not a function
    
  6. jeffreyjackson commented on Jul 15, 2017

    @jeffreyjackson

    I think @dplewis is correct

  7. flovilmart commented on Jul 15, 2017

    @flovilmart
    Contributor

    Ok that’s an issue in the adapter. Can we open it there?

  8. flovilmart commented on Jul 15, 2017

    @flovilmart
    Contributor

    As a work around, you can use alert: { title: «title » }

  9. sfertman commented on Aug 8, 2017

    @sfertman

    I saw that the issue was fixed in parse-modules/parse-server-push-adapter but the fix is not marked "latest" and npm still pulls the buggy version on install

  10. uhw76tgwquerhjbqwnejk commented on Aug 16, 2017

    @uhw76tgwquerhjbqwnejk

    npm still pulling the buggy version as well for me

  11. riccardoch commented on Oct 5, 2017

    @riccardoch

    This issue has not yet been solved. How can I force to install the last version of parse-server-push-adapter?

  12. gatthias commented on Oct 6, 2017

    @gatthias

    Indeed it still breaks if title is set as in doc. However as @flovilmart suggested, you can use :

    As a work around, you can use alert: { title: «title » }

    In that case, if you still want a message besides this title (which most of us would), you can use the property "body", giving :
    { "title": "MyTitle", "body": "MyMessage" }
    Which should be set as the notification "data" field value. In case it's still not clear, use this way :

    Parse.push({
      where: { ... },
      data: {
          alert: { title: "MyTitle", body: "Say cheese :) !" },
       }
    })...
    

    Just tested with latest Parse & Parse Server, all good.
    Bonus, you get title for iOS devices too (If I'm correct on the 'old' title way).

  13. riccardoch commented on Oct 6, 2017

    @riccardoch

    @opulisDynamics Thanks, but It's not good for me to change the JSON, because the notifications are sent by embedded devices and I have a lot of those distributed and update the software on all of them only for this reason is not good, so the best solution for me (at the moment) was to edit parse-server-push-adapter, like someone has suggested.

  14. flovilmart commented on Oct 6, 2017

    @flovilmart
    Contributor

    It just need a release The latests version from master then!

  15. stale commented on Sep 18, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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