Skip to content

Push notification not sending #8249

Open
@rafaelpolicarpo

Description

@rafaelpolicarpo

New Issue Checklist

Issue Description

Push notifications dont working in version 5 in cloud code.

Steps to reproduce

Using version 4.10.17 or lower push notifications are sent successfully, however when upgrading to version 5.0.0 or higher, push is no longer sent.

Actual Outcome

I get the following record from the unsent push.

 {
            "objectId": "XXXXX",
            "pushTime": "2022-10-18T18:12:30.297Z",
            "query": "{\"user\":{\"__type\":\"Pointer\",\"className\":\"XXXX\",\"objectId\":\"XXXXXX\"}}",
            "payload": "{\"badge\":\"increment\",\"sound\":\"default\",\"title\":\"Parse Novo\",\"alert\":\"Teste Parse Novo\"}",
            "source": "rest",
            "status": "failed",
            "numSent": 0,
            "pushHash": "95d3ae83f52749e1adf3667eadff75e5",
            "createdAt": "2022-10-18T18:12:30.298Z",
            "updatedAt": "2022-10-18T18:12:30.398Z",
            "errorMessage": {
                "index": 0,
                "code": 66
            },
            "ACL": {}
        }

Expected Outcome

Expected the push to be sent successfully.

 {
            "objectId": "XXXX",
            "pushTime": "2022-10-18T16:15:58.026Z",
            "query": "{\"user\":{\"__type\":\"Pointer\",\"className\":\"XXXX\",\"objectId\":\"XXXXX\"}}",
            "payload": "{\"badge\":\"increment\",\"sound\":\"default\",\"title\":\"Parse Antigo\",\"alert\":\"Teste push staging\"}",
            "source": "rest",
            "status": "succeeded",
            "numSent": 1,
            "pushHash": "1cfd7f7a3c8d7f0f34c25c1a4f68dd93",
            "createdAt": "2022-10-18T16:15:58.027Z",
            "updatedAt": "2022-10-18T16:15:58.343Z",
            "sentPerType": {
                "android": 1
            },
            "ACL": {}
        },

Environment

Tested on all versions higher than 5.0.0, but currently using 5.2.4

Server

  • Parse Server version: 5.2.4
  • Operating system: Linux (Ubuntu 20.04.2 LTS)
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): AWS

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 5.0.13
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas

Logs

data in my server log.

{"functionName":"xxxx","level":"info","message":"Ran cloud function xxxx for user undefined with:\n  Input: {\"xxx\":\"xxxxxx\",\"title\":\"Parse Antigo 1\",\"message\":\"Teste Parse Antigo\"}\n  Result: undefined","params":{"xxx":"xxxxxx","message":"Teste Parse Antigo","title":"Parse Antigo 1"},"success":true,"tag":"ParseServer","timestamp":"2022-10-18T19:30:14.614Z"}
{"className":"_Installation","input":{"badge":{"__op":"Increment","amount":1}},"level":"info","message":"beforeSave triggered for _Installation for user undefined:\n  Input: {\"badge\":{\"__op\":\"Increment\",\"amount\":1}}\n  Result: {\"object\":{\"badge\":{\"__op\":\"Increment\",\"amount\":1}}}","output":{"object":{"badge":{"__op":"Increment","amount":1}}},"success":true,"tag":"ParseServer","timestamp":"2022-10-18T19:30:14.771Z","triggerType":"beforeSave"}
{"code":66,"index":0,"level":"error","message":"_PushStatus xxxxxx: error while sending push","success":true,"tag":"ParseServer","timestamp":"2022-10-18T19:30:14.853Z"}

with verbose enabled i have the following data (localhost):

2022-10-19T05:21:50.643Z/ParseServer/ (unknown location): REQUEST for [POST] /parse/push: {
  "where": {
    "user": {
      "__type": "Pointer",
      "className": "_User",
      "objectId": "xxxx"
    }
  },
  "data": {
    "badge": "increment",
    "sound": "default",
    "title": "Parse Antigo 5.0.0",
    "alert": "Teste Parse Antigo"
  }
}
2022-10-19T05:21:50.859Z/ParseServer/ (unknown location): RESPONSE from [POST] /parse/push: {
  "headers": {
    "X-Parse-Push-Status-Id": "xxxx"
  },
  "response": {
    "result": true
  }
}
POST /parse/push 200 223.844 ms - 15
2022-10-19T05:21:51.060Z/ParseServer/ (unknown location): beforeSave triggered for _Installation for user undefined:
  Input: {"badge":{"__op":"Increment","amount":1}}
  Result: {"object":{"badge":{"__op":"Increment","amount":1}}}
2022-10-19T05:21:51.444Z/ParseServer/ (unknown location): _PushStatus xxxxx: error while sending push

in version 5.0.0 i have this information in _PushStatus collection:

"errorMessage": {
                "driver": true,
                "name": "MongoError",
                "index": 0,
                "code": 66
            },

however in 5.2.4 i have only this informations:

"errorMessage": {
                "index": 0,
                "code": 66
            },

in version 4.10.17 i have this data:

2022-10-19T05:31:03.721Z/ParseServer/ (unknown location): REQUEST for [POST] /parse/push: {
  "where": {
    "user": {
      "__type": "Pointer",
      "className": "_User",
      "objectId": "xxxxx"
    }
  },
  "data": {
    "badge": "increment",
    "sound": "default",
    "title": "Parse Antigo 5.0.0",
    "alert": "Teste Parse Antigo"
  }
}
2022-10-19T05:31:04.316Z/ParseServer/ (unknown location): RESPONSE from [POST] /parse/push: {
  "headers": {
    "X-Parse-Push-Status-Id": "xxxxxx"
  },
  "response": {
    "result": true
  }
}
POST /parse/push 200 611.647 ms - 15
2022-10-19T05:31:04.871Z/ParseServer/ (unknown location): beforeSave triggered for _Installation for user undefined:
  Input: {"badge":{"__op":"Increment","amount":1}}
  Result: {"object":{"badge":{"__op":"Increment","amount":1}}}
2022-10-19T05:31:05.089Z/ParseServer/ (unknown location): afterSave triggered for _Installation for user undefined:
  Input: {"updatedAt":"2022-10-19T05:31:04.319Z"}
2022-10-19T05:31:05.093Z/ParseServer/ (unknown location): afterSave triggered for _Installation for user undefined:
  Input: {"updatedAt":"2022-10-19T05:31:04.319Z"}
  Result: undefined
2022-10-19T05:31:05.282Z/ParseServer/ (unknown location): _PushStatus xxxxx: sending push to installations with %d batches
**(node:21976) [MONGODB DRIVER] DeprecationWarning: collection.findOneAndUpdate option [returnOriginal] is deprecated and will be removed in a later version.**
2022-10-19T05:31:05.853Z/ParseServer/ (unknown location): Sending push to 1
2022-10-19T05:31:06.320Z/ParseServer/ (unknown location): _PushStatus xxxxx: sent push! %d success, %d failures
2022-10-19T05:31:06.321Z/ParseServer/ (unknown location): _PushStatus xxxxx: needs cleanup

thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions