Skip to content

Push Notifications - iOS - expiration_time #20

@flovilmart

Description

@flovilmart

Initially Opened by @alistairbrightec as parse-community/parse-server#1959

When sending a push notification from cloud code to an iOS device, the cloud function returns successful however the server crashes with the following:

at flush (/bundle/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:125:13) at runSingle (/bundle/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:137:13) at /bundle/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:1391:14 at Promise.promise.promiseDispatch (/bundle/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:788:41) at Promise.apply (/bundle/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:1165:26) at Connection. (/bundle/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/lib/connection.js:287:8) at Connection.serviceBuffer (/bundle/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/lib/connection.js:330:13) at Connection.transmitNotification (/bundle/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/lib/connection.js:691:8) at Buffer.writeUInt32BE (buffer.js:923:5) at checkInt (buffer.js:830:11) TypeError: value is out of bounds ^ throw err; /bundle/node_modules/parse-server/lib/ParseServer.js:333

After digging into it, it only crashes if we include the line:

var oneWeekAway = new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000); ..... expiration_time: oneWeekAway,

The server I am using is one hosted by https://www.nodechef.com/parse-server and they requested that I posted this issue here

Steps to reproduce

  1. Add expiration_time into a push sent to an iOS device

Expected Results

No crash, send push notification, cloud function returns successfully

Actual Outcome

Server crashes and the cloud function returns successfully

Environment Setup

  • Server
    • parse-server version: 2.2.10
    • Operating System: Unknown
    • Hardware: Unknown
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Unknown
  • Database
    • MongoDB version: Unknown
    • Storage engine: Unknown
    • Hardware: Unknown
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Unknown

Logs/Trace

Unknown

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