APNS VError: stream ended unexpectedly on IOS
Issue Description
I'm unable to get notifications working on iOS on remote server. Notifications are working on Android, and working on iOS when testing them using CURL commands with my Apple Push certificate (development and production mode on testflight, changing device tokens respectively). So I'm trying to send a push using parse dashboard to a iOS device on development and production mode and it fails.
Push Configuration
push:{ android: { senderId: 'XXX', apiKey: 'XXX' }, ios:[ { pfx: './pushCerts/push.p12', topic: 'com.xx.xx', production: false },{ pfx: './pushCerts/push.p12', topic: 'com.xx.xx', production: true } ] }
Push certificate is the same, as you can generate a single certificate for both development and production. I also tried with different certs (one for dev and one for prod) with no result.
Environment Setup
-
Server
- parse-server version: 3.0.0
- Operating System: Ubuntu 16.04
- Hardware: ---
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): OVH
-
Database
- MongoDB version: 3.6.10
- Storage engine:
-
Hardware: ---
-
Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): localhost
Logs/Trace
0|parse-server | ERR!
0|parse-server |
0|parse-server | parse-server-push-adapter APNS
0|parse-server | VError: stream ended unexpectedly
0|parse-server | ERR!
0|parse-server |
0|parse-server | parse-server-push-adapter APNS
0|parse-server | at ClientHttp2Stream.request.on (/root/parse/node_modules/apn/lib/client.js:120:23)
0|parse-server | ERR! parse-server-push-adapter APNS at ClientHttp2Stream.emit (events.js:182:13)
0|parse-server | ERR! parse-server-push-adapter APNS at ClientHttp2Stream.EventEmitter.emit (domain.js:441:20)
0|parse-server | ERR! parse-server-push-adapter APNS at endReadableNT (_stream_readable.js:1094:12)
0|parse-server | ERR! parse-server-push-adapter APNS at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)
0|parse-server | ERR! parse-server-push-adapter APNS at process._tickCallback (internal/process/next_tick.js:63:19)
0|parse-server | ERR! parse-server-push-adapter APNS APNS error transmitting to device %s with error %s 8520c4ce1039ffe5badd7ec752a4a1a7ced31a94e246b6f22321cff21b1e1016 { VError: stream ended unexpectedly
0|parse-server | ERR! parse-server-push-adapter APNS at ClientHttp2Stream.request.on (/root/parse/node_modules/apn/lib/client.js:120:23)
0|parse-server | ERR! parse-server-push-adapter APNS at ClientHttp2Stream.emit (events.js:182:13)
0|parse-server | ERR! parse-server-push-adapter APNS at ClientHttp2Stream.EventEmitter.emit (domain.js:441:20)
0|parse-server | ERR! parse-server-push-adapter APNS at endReadableNT (_stream_readable.js:1094:12)
0|parse-server | ERR! parse-server-push-adapter APNS at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)
0|parse-server | ERR! parse-server-push-adapter APNS at process._tickCallback (internal/process/next_tick.js:63:19)
0|parse-server | ERR! parse-server-push-adapter APNS jse_shortmsg: 'stream ended unexpectedly',
0|parse-server | ERR! parse-server-push-adapter APNS jse_info: {},
0|parse-server | ERR! parse-server-push-adapter APNS message: 'stream ended unexpectedly',
0|parse-server | ERR! parse-server-push-adapter APNS stack:
0|parse-server | ERR! parse-server-push-adapter APNS 'VError: stream ended unexpectedly\n at ClientHttp2Stream.request.on (/root/parse/node_modules/apn/lib/client.js:120:23)\n at ClientHttp2Stream.emit (events.js:182:13)\n at ClientHttp2Str
ntEmitter.emit (domain.js:441:20)\n at endReadableNT (_stream_readable.js:1094:12)\n at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)\n at process._tickCallback (internal/process/next_ti
3:19)' }
Solved this issue. For others that are experiencing this problem, it is related to the export procedure of the iOS certificate. It just worked by selecting the certificate under "My certificates" on Keychain App and exporting it as .p12 file. Exporting the certificate from other folder different from "my certificates" will result on this error. I don't know why it worked on other program (APN tester) and not on Parse Server but it's fixed now..