node-apn / node-apn

:calling: Apple Push Notification module for Node.js
MIT License
4.37k stars 681 forks source link

session.close is not a function #702

Open Vishal-sol opened 3 years ago

Vishal-sol commented 3 years ago
Notification paylod::
1|app    |  {
1|app    |   "aps": {
1|app    |     "handle": "TEST NAME",
1|app    |     "notification_type": "voip",
1|app    |     "hasVideo": "0",
1|app    |     "toPhoneExt": "1000",
1|app    |     "callTime": "1617185365844",
1|app    |     "deviceToken": "<XXXXXXXXX>",
1|app    |     "callFromExt": "4002",
1|app    |     "callerImage": "/imgs/default.jpg",
1|app    |     "alert_type": "voip_call",
1|app    |     "deviceType": "ios",
1|app    |     "env": "production"
1|app    |   }
1|app    | }
TypeError: session.close is not a function
1|app    |     at Client.closeAndDestroySession (/root/4call-pushnotification/node_modules/@parse/node-apn/lib/client.js:68:17)
1|app    |     at ClientHttp2Session.session.on (/root/4call-pushnotification/node_modules/@parse/node-apn/lib/client.js:97:14)
1|app    |     at emitTwo (events.js:126:13)
1|app    |     at ClientHttp2Session.emit (events.js:214:7)
1|app    |     at TLSSocket.socketOnError (internal/http2/core.js:2109:15)
1|app    |     at emitOne (events.js:116:13)
1|app    |     at TLSSocket.emit (events.js:211:7)
1|app    |     at emitErrorNT (internal/streams/destroy.js:64:8)
1|app    |     at _combinedTickCallback (internal/process/next_tick.js:138:11)
1|app    |     at process._tickDomainCallback (internal/process/next_tick.js:218:9)

I'm facing this issue when sending a Push Notification using the new Provider API of node-apn package.

But the thing is, this notification is sent successfully sometimes, but throws this exact error in every push notification at other times. This behaviours seems totally random.

TysonAndre commented 3 years ago

node_modules/@parse/node-apn is a fork of this at https://github.com/parse-community/node-apn/

It'd help to include the node version and version of @parse/node-apn if filing an issue there (should update to latest), as well as manually debugging what session.close actually was