parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
88 stars 100 forks source link

Parse Server Crash on invalid/expired APNS cert #65

Closed bnol closed 6 years ago

bnol commented 7 years ago

I would like to reference an issue from https://github.com/ParsePlatform/parse-server/issues/3575 which crashes the node process when APNS cert is expired. It also happens for me, here is the stack trace:

3|parse-se | Error: certificate has expired: 2016-09-27T04:03:38.000Z
3|parse-se |     at validateCredentials (/opt/parse-server-tc/node_modules/apn/lib/credentials/validate.js:12:9)
3|parse-se |     at /opt/parse-server-tc/node_modules/apn/lib/connection.js:163:5
3|parse-se |     at _fulfilled (/opt/parse-server-tc/node_modules/q/q.js:834:54)
3|parse-se |     at self.promiseDispatch.done (/opt/parse-server-tc/node_modules/q/q.js:863:30)
3|parse-se |     at Promise.promise.promiseDispatch (/opt/parse-server-tc/node_modules/q/q.js:796:13)
3|parse-se |     at /opt/parse-server-tc/node_modules/q/q.js:604:44
3|parse-se |     at runSingle (/opt/parse-server-tc/node_modules/q/q.js:137:13)
3|parse-se |     at flush (/opt/parse-server-tc/node_modules/q/q.js:125:13)
3|parse-se |     at _combinedTickCallback (internal/process/next_tick.js:67:7)
3|parse-se |     at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:122:9)

parse-server-push-adapter version: 1.2.0

oyvindvol commented 6 years ago

Any thoughts on this one, anyone? I am having the same problem.

shide1989 commented 6 years ago

Same problem here, anyone knows how to solve this ?

flovilmart commented 6 years ago

This is expected, just pass proper/valid certiticates

shide1989 commented 6 years ago

how do you do it ? any link to help ? i'm new to parse

flovilmart commented 6 years ago

What do you mean how do you do it? Did you follow the documentation to configure push properly available on docs.parseplatform.org?

shide1989 commented 6 years ago

actually i wasn't aware of docs.parseplatform.org. I'll check that, thanks

flovilmart commented 6 years ago

Also, the push configuration is the first link on the first line of the README of this repository.

gateway commented 5 years ago

Hi, I just ran into this on our staging servers. I woke up to crashed servers and it looks like our iOS push cert for dev expired. While I'm in the process of fixing this ideally if a cert expires the app shouldn't crash ?

flovilmart commented 5 years ago

@gateway this is the expected behavior, as it is the node apn’s behavior, as stated many time. Feel free to fix it.

gateway commented 5 years ago

@flovilmart your right, looking at the first line of the error, using node-apn .. odd that something like an expired cert would crash a server.. hmm well thanks...

paprbot commented 3 years ago

How are you checking for certificate expiration? I noticed our certificate's expiration on Apple is 2021/10/01 (i.e. October) but we got a crash on our servers yesterday (2021/01/10). Or is this a configuration that we need to setup?

oyvindvol commented 3 years ago

@paprbot You can check when the certificates expire in Apple Developer Account.

dplewis commented 3 years ago

@paprbot I would recommend using keys instead of certs. Since keys don't expire.

ios: [
      {
        token: {
          key: './push/AuthKey_XYZ.p8',
          keyId: "ABC",
          teamId: "EFG"
        },
        topic: 'com.example',
      },
]
Screen Shot 2019-10-14 at 7 07 53 PM