question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

push notification error 8

See original GitHub issue

Does this error mean I have set up my cert and key pem files incorrectly? I get the following log:

Connected Notification transmitted to:98d86f0605e899fea311c82b13bc774c8ca58ba1208333ca2403fdc0d4ecbc7f Notification caused error: 8 for device { token: <Buffer 98 d8 6f 06 05 e8 99 fe a3 11 c8 2b 13 bc 77 4c 8c a5 8b a1 20 83 33 ca 24 03 fd c0 d4 ec bc 7f> } { encoding: ‘utf8’, payload: { aps: { alert: ‘Hello, from node-apn! You are number: 0’ } }, expiry: 0, identifier: 0, priority: 10, retryLimit: -1, device: undefined, alert: ‘Hello, from node-apn! You are number: 0’, badge: ‘0’, sound: undefined, newsstandAvailable: undefined, contentAvailable: undefined, mdm: undefined, compiled: true, truncateAtWordEnd: false, urlArgs: undefined, compiledPayload: ‘{“aps”:{“alert”:“Hello, from node-apn! You are number: 0”}}’ } Disconnected from APNS

I copied your example code:

var apn = require(‘apn’); var tokens = [“my token with no spaces”];

if(tokens[0] == “<insert token here>”) { console.log(“Please set token to a valid device token for the push notification service”); process.exit(); }

// Create a connection to the service using mostly default parameters. var service = new apn.connection({ gateway:‘gateway.sandbox.push.apple.com’ });

service.on(‘connected’, function() { console.log(“Connected”); });

service.on(‘transmitted’, function(notification, device) { console.log(“Notification transmitted to:” + device.token.toString(‘hex’)); });

service.on(‘transmissionError’, function(errCode, notification, device) { console.error("Notification caused error: " + errCode + " for device ", device, notification); });

service.on(‘timeout’, function () { console.log(“Connection Timeout”); });

service.on(‘disconnected’, function() { console.log(“Disconnected from APNS”); });

service.on(‘socketError’, console.error);

// If you have a list of devices for which you want to send a customised notification you can create one and send it to and individual device. function pushSomeNotifications() { for (var i in tokens) { var note = new apn.notification(); note.setAlertText("Hello, from node-apn! You are number: " + i); note.badge = i;

    service.pushNotification(note, tokens[i]);
}

}

pushSomeNotifications();

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12

github_iconTop GitHub Comments

4reactions
btelintelocommented, Mar 29, 2016

For anyone else googling and stumbling on to this issue, check to make sure that the cert which you generated the pem file matches the app bundle id of the app you are running. Also make sure that in xcode, you have push notifications turned on in your project’s target capabilities!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push Notification Service — HTTP Response Codes
HTTP Response Codes · 200 OK — Message accepted by service. · 401 DENIED — Service token/auth key denied · 403 FORBIDDEN —...
Read more >
Handling Notification Responses from APNs
Apple Push Notification service (APNs) provides a response to each POST request your server transmits. Each response contains a header with fields ...
Read more >
APNS notification fails to be delivered (error code 8)
It appeared to be another error. The server contained old deployment (war) file, which was still pointing to the sandbox APNS environment.
Read more >
Web Push errors explained (with HTTP status codes)
Web Push errors explained (with HTTP status codes) · 400 Bad Request · 401 Unauthorized, 403 Forbidden · 404 Not Found · 410...
Read more >
Push Notification Troubleshooting - TechDocs - Broadcom Inc.
This behavior is due to a difference in the hostname at the time of registration and authentication. When you configure Calllout for Push ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found