Push Notifications stopped working
ssgsgugel opened this issue · 2 comments
Moved from issue [#5379]parse-community/parse-server#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
-
The .p12 file was just created to replace the .p12 file that expired. And yes, the .p12 file was created from the cert that is loaded onto the app's site for production.
-
Yes, we followed the same steps as all the online tutorials that are usually referenced.
-
We know it was working until the February time frame. No code changes were made until we started debugging the problem with you all, and that was just to get more debugging enabled.
FYI, we have verified that the ports are available on our AWS server
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.