raix-push: Socket hang up, have tested all certificates and device tokens for APN

Ok, I feel like we are so close here, but end up with socket hang up. I have tested the certificates using openssl on the command line, and manually sent a notification to my phone using the device token obtained looking at the output of Push.debug = true. On the logs, it is claiming Push: APN configured. It seems like everything should be in the clear, but when I call a test push from the server with the code:

Push.send({ 
      from: 'push', 
      title: 'Hello', 
      text: 'World',
      query: {},
  }); 

Debug output seems promising

Push: Sent message "Hello" to 1 ios apps 0 android apps

Then there is a socket hang up,

Error: socket hang up
    at TLSSocket.onHangUp (_tls_wrap.js:1054:19)
    at TLSSocket.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at TLSSocket.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:923:12)
    at nextTickCallbackWith2Args (node.js:458:9)
    at process._tickCallback (node.js:372:17) 

It would seem there is an issue calling the APN server, I’ve double checked to ensure the production/development mismatch is not an issue as well. The app is deployed on a Digital Ocean droplet using mup. This has been royally frustrating, and I greatly appreciate any insight.

About this issue

Most upvoted comments

Same problem here. Certificates still valid and was working without any problems. From one day to another, it broke. Using DigitalOcean too.

@raix anyway not to take the whole server down if a certificate expires? Maybe use try/catch I have not looked at the code or if this was even possible yet… sorry was frantically trying to get my server back in business.

Ok, so looks like I found my issue … the certificate had expired… phew no warning form Apple and I thought I’d checked/renewed. I could not even find my certs in the apple dev console, so I am guessing the expired them and just removed them.

Also looks like they have a new non-Expiring option that uses a p8 file time (instead of p12)… no sure if this could work with the pushplugin… http://stackoverflow.com/questions/39672297/how-to-use-apples-new-p8-certificate-for-apns-in-firebase-console ?

We saw this error today, and it turned out to be an expired Apple Push Notification certificate. Thx @adamgins for leading us in the right direction! My only concern/request is that this type of error fails more gracefully, as it brought down our mobile app.