evanshortiss / sns-mobile

Push notifications to Android, Kindle, and iOS devices easily using this module.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Push sending has random error

ashish-nodejs opened this issue · comments

'Invalid parameter: Token Reason: Endpoint arn:aws:sns:*******************:endpoint/APNS_SANDBOX/**************/480e971c-******-bc02-****** already exists with the same Token, but different attributes.',
It give above error ..
Randomly it not goes addUser function also and not give any error too..
plz tell me what i did wrong.
It runs some and some time not
I declare iosApp object as well..

iosApp.addUser(deviecToken, JSON.stringify({
   									some: 'extra data'
   								}), function (err, endpointArn) {
   									if (err) {
   										console.log(err);
   										//resolve(1);
   									} else {
   										
   										console.log("addUser : " + messageId)
   										let endpp = endpointArn;
   										// Send a simple String or data to the client
   										iosApp.sendMessage(endpp, msg, function (err, messageId) {
   											console.log("Push send to : " + messageId)
   											//resolve(1);
   										});
   									}
   								});

I cant reveal whole code..but almost..
@evanshortiss

@ashish-ajm I recommend checking with AWS support for this. Here's one thread discussing this issue - https://forums.aws.amazon.com/thread.jspa?messageID=570797

It sounds to me like you are trying to add the same user multiple times. When you add the user you need to store the ARN so you know they've already been added, and use that ARN in the future.

@ashish-ajm closing. If you find that this is a bug with the module feel free to reopen.