Node-apn Error 8
Contents |
Sign in Pricing Blog Support Search GitHub This repository Watch 105 Star 2,684 Fork 352 node-apn/node-apn Code Issues apns error 8 10 Pull requests 1 Projects 0 Wiki Pulse Graphs New issue apn error 513 Unable to send push notifications (error 8) #235 Closed veli-kaksonen opened this Issue Dec 11, 2014 apn raising error: 8 · 5 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 2 participants veli-kaksonen commented Dec 11, 2014 I
Node.js Apn
implemented push notification using node-apn some time ago and it worked just fine. Today my server restarted and I tried the push notification again just to notice it does not work anymore. I turned on the debugs and got this: Sending push notification - deviceToken: 1bd029f7d7bf7bae97d63ab81736e9aac9e3a072982e0de253546b4b622ececc - text: 'test' apn Initialising connection +0ms apn apns invalid token Initialising module +1ms apn 1 left to send +1ms apn Connection established +517ms apn Transmitting notification from buffer +0ms apn Socket drained +1ms 0 apn 0 left to send +0ms apn 0 left to send +1ms apn Notification 0 caused an error: 8 +113ms apn Raising error: +0ms 8 { encoding: 'utf8', payload: { messageFrom: 'Huimio', aps: { badge: 2, sound: 'ping.aiff', alert: 'You have a new support chat message!' } }, expiry: 1418894959, identifier: 0, priority: 10, retryLimit: -1, device: undefined, alert: 'You have a new support chat message!', badge: 2, sound: 'ping.aiff', newsstandAvailable: undefined, contentAvailable: undefined, mdm: undefined, compiled: true, truncateAtWordEnd: false, urlArgs: undefined, compiledPayload: '{"messageFrom":"Huimio","aps":{"badge":2,"sound":"ping.aiff","alert":"You have a new support chat message!"}}' } { token:
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack http://stackoverflow.com/questions/32232715/sending-push-using-node-apn-always-returns-invalid-token-8 Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a http://stackoverflow.com/questions/22023114/node-apn-error-513-when-attempting-to-send-push-notification community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Sending Push using node-apn always returns Invalid token (8) up vote 2 down vote favorite I'm error 8 trying to get my node.js app to successfully send a push notification to my device. In the beginning I was sure I'm making some mistake with my push certificate / key, so I wrote the same thing in Ruby just to be sure, in which it works perfectly. When i try using nomad-cli (command line tool) or just use Nomad in Ruby it works fine and it takes a single PEM node-apn error 8 file that contains both key and cert it looks like this apn push "21329bc4164a56226a982f3daea4e3ace5e6c1788e4dc3a75248eca330b280a300" -c ./apns.pem -m "CLI Hello" And returns "1 push notification sent successfully" which immediately shows it on my device. On my node.js code, I'm using node-apn which requires separate cert and key PEM files. So I tried separating with various methods, but I always get the same error : invalid token (8) Which makes no sense , since the same token works with the same PEM file in the Ruby test I wrote ... I'm really pulling my non-existing bald-headed hairs here... Stuck on this for two days now. I tried separating with the following methods : Tried to just convert the p12 to pem and use the PEM for both cert/key fields Convert to PEM , then manually open the PEM and separate it to key.pem and cert.pem (Using -----BEGIN CERTIFICATE----- and -----BEGIN RSA PRIVATE KEY----- Tried to split separately using the following commands: openssl pkcs12 -in apns.p12 -nocerts -out key.key // Extract key openssl rsa -in key.key -outform PEM -out key.pem // Decrypt key openssl pkcs12 -in apns.p12 -clcerts -nokeys -out cert.pem // Extract Certificate With all of these methods, my node.js code fails with an error code of 8. My node.js code looks a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up node-apn Error 513 when attempting to send Push Notification up vote -1 down vote favorite I have a PHP script that works great and sends messages to my iPhone over APNS but when I try to use the node-apn module, I get Error 513. In my PHP code I do things a little differently (see below); namely, I remove the spaces from the device token and "hex" it. I also use a combined cert-key.pem that Apple recommends creating using openssl cli. In node-apn, it appears you have to define the cert and the key separately so I just use the respective cert/key pem files I create from openssl. Any ideas why this might not be working? Node code at the bottom. PHP code: