parse-community / parse-server-push-adapter

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

Push Notifications stopped working #122

Closed ssgsgugel closed 5 years ago

ssgsgugel commented 5 years ago

Moved from issue [#5379]https://github.com/parse-community/parse-server/issues/5379, which is now closed. Here is the gist of it:

Issue Description

We have been running parse-server on AWS hosted ubuntu servers for a few months now and have been successfully pushing notifications out through the cloud push features for our iOS app. At some point between February 6th and February 13th, our push notifications stopped working through Parse and APN. As shown in the sample log statement below, we receive a success back from the send; however, our dashboard indicates the status is stuck at "SENDING". No errors are reported. We have updated the .p12 file with the latest generated from our developer site. However, no luck in getting it to work.

We have scanned both parse, apple, and AWS support areas but haven't see any issues reported.

Push Configuration

push: { ios: { pfx: 'certs/########.p12', bundleId: 'io.#####.#####', production: true } }

The master key is also specified in the server code.

Sample of our cloud main.js file that has been working fine.

Parse.Push.send({ where: pushQuery, data: { alert: message, badge: "Increment", sound: 'default', objectId: matchId } },{ useMasterKey: true, success: function() { console.log('Message sent successfully'); res.success('Message was sent successfully'); }, error: function(error) { console.log('Error sending push'); res.error(error); } });

Environment Setup

Server

parse-server version (Be specific! Don't say 'latest'.) : Express 1.4.0 Operating System: Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-105-generic x86_64) Hardware: AWS ECS Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): AWS Database

MongoDB version: v3.4.15 Storage engine: Hardware: Same as above Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): AWS Logs/Trace

{"functionName":"sendpush","params":{"matchId":"####","message":"Test","senderId":"######","recipName":"#####","recipId":"######"},"user":"######","level":"info","message":"Ran cloud function sendpush for user ###### with:\n Input: {"matchId":"#######","message":"Test","senderId":"#######","recipName":"####","recipId":"######"}\n Result: "Message was sent successfully"","timestamp":"2019-02-16T22:29:44.110Z"}

Note: All ids and sensitive information was replaced with "#####"

Additional Log traces Okay, now that I have found the correct log files and with the environment variables set, here is what I see occurring. Does this usually mean the .p12 file is incorrect/bad, or is this something else like a port connection failure? If it's the .p12, I swear we just created it so that it was current in case that is the problem.

/home/ubuntu/parse-server-example/node_modules/parse-server/lib/ParseServer.js:437 throw err; ^

Error: mac verify failure at Error (native) at Object.createSecureContext (_tls_common.js:136:17) at Object.TLSSocket._init.ssl.onclienthello.ssl.oncertcb.exports.connect (_tls_wrap.js:1007:48) at apnSocket (/home/ubuntu/parse-server-example/node_modules/apn/lib/socket.js:56:19) at Connection. (/home/ubuntu/parse-server-example/node_modules/apn/lib/connection.js:199:17) at _fulfilled (/home/ubuntu/parse-server-example/node_modules/q/q.js:834:54) at self.promiseDispatch.done (/home/ubuntu/parse-server-example/node_modules/q/q.js:863:30) at Promise.promise.promiseDispatch (/home/ubuntu/parse-server-example/node_modules/q/q.js:796:13) at /home/ubuntu/parse-server-example/node_modules/q/q.js:604:44 at runSingle (/home/ubuntu/parse-server-example/node_modules/q/q.js:137:13) ERR! parse-server-push-adapter APNS cannot find vaild connection for 9d2dced6bc5f3079928edc3317a36ccc7125a396997b62e91421fe84e8abf5e8 ERR! parse-server-push-adapter APNS cannot find vaild connection for dd5f84e01838117ecaa9d28d25d184f10366f3adf515333bdbf097eaa66514f7 Error: mac verify failure at Error (native) at Object.createSecureContext (_tls_common.js:136:17) at Object.TLSSocket._init.ssl.onclienthello.ssl.oncertcb.exports.connect (_tls_wrap.js:1007:48) at apnSocket (/home/ubuntu/parse-server-example/node_modules/apn/lib/socket.js:56:19) at Connection. (/home/ubuntu/parse-server-example/node_modules/apn/lib/connection.js:199:17) at _fulfilled (/home/ubuntu/parse-server-example/node_modules/q/q.js:834:54) at self.promiseDispatch.done (/home/ubuntu/parse-server-example/node_modules/q/q.js:863:30) at Promise.promise.promiseDispatch (/home/ubuntu/parse-server-example/node_modules/q/q.js:796:13) at /home/ubuntu/parse-server-example/node_modules/q/q.js:604:44 at runSingle (/home/ubuntu/parse-server-example/node_modules/q/q.js:137:13) /home/ubuntu/parse-server-example/node_modules/parse-server/lib/ParseServer.js:437 throw err; ^

Error: mac verify failure at Error (native) at Object.createSecureContext (_tls_common.js:136:17) 90509,1 99%

What we know

ssgsgugel commented 5 years ago

FYI, we have verified that the ports are available on our AWS server

ssgsgugel commented 5 years ago

This issue did have to do with the .p12 files. Accidentally generated a password for it the first time around. The .p12 file has now been updated to no longer require one.