parse-community / parse-server-push-adapter

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

APNS adapter failure -- cannot find valid connection #15

Closed tylerarnold closed 8 years ago

tylerarnold commented 8 years ago

I receive the following error: "ERR! parse-server-push-adapter APNS cannot find vaild connection for " when trying to debug push notifications on a local server environment. Note that with the same .p12 key /certificate, I can successfully push notifications to APNS and the same iPhone via a php script running locally.

Environment Setup

parse server 2.27 running on OSX

Steps to reproduce

configure with one installation from app, start server locally with pfx config pointed to .p12 file. start a APNS push via curl or the parse-dashboard.

Logs/Trace

"verbose: sending push to 1 installations ERR! parse-server-push-adapter APNS cannot find vaild connection for 768dfdea3b13c3f2ab64dcf3d5fc82e4dd5081189e8d98bf848fa579b848c1a1 /usr/local/lib/node_modules/parse-server/lib/ParseServer.js:329 throw err; ^

Error: mac verify failure at Error (native) at Object.createSecureContext (_tls_common.js:132:17) at Object.TLSSocket._init.ssl.onclienthello.ssl.oncertcb.exports.connect (_tls_wrap.js:972:23) at apnSocket (/usr/local/lib/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/lib/socket.js:56:19) at Connection. (/usr/local/lib/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/lib/connection.js:199:17) at _fulfilled (/usr/local/lib/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:834:54) at self.promiseDispatch.done (/usr/local/lib/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:863:30) at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:796:13) at /usr/local/lib/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:604:44 at runSingle (/usr/local/lib/node_modules/parse-server/node_modules/parse-server-push-adapter/node_modules/apn/node_modules/q/q.js:137:13)

tylerarnold commented 8 years ago

I figured this out. my p12 key had a password, which was handled fine in my php script but I forgot about it when I started using it when configuring parse server. Making a version of the p12 without a password fixes the issue.

flovilmart commented 8 years ago

By the way, you can and should have a password on your p12. Just provided it in the adapter options

achimkoellner commented 5 years ago
new ParseServer({
  ....
  "push": {
    "adapter": new PushAdapter({
       ....
       "ios": [{
          "pfx": 'your-certificate.p12',
          "topic": 'your-app',
          "passphrase": 'your-passphrase',
          "production": true
      ]}
  })
})