Tillson
Tillson

Reputation: 530

AWS SNS publishing always disables endpoint (invalid token)

I'm trying to use a Lambda function to send a notification to an iOS device using SNS, but every time I send it, the status of the endpoint changes to false and an error appears in CloudWatch saying invalid token (below).

I have confirmed that the token is the same one as phone's, and that it is sending to that. I have also tried to regenerate the certificates 3 times now, and the same error still appears.

CloudWatch error

{
    "status": "FAILURE",
    "notification": {
        "timestamp": "2015-10-20 03:27:46.5",
        "messageId": "id",
        "messageMD5Sum": "sum"
    },
    "delivery": {
        "statusCode": 8,
        "dwellTimeMs": 473,
        "token": "f0b1abebdbc08d4f0c46a7a0620e518af886952c9f8e21e22cff5a5fc5ca5098",
        "attempts": 1,
        "providerResponse": "NotificationErrorResponse(command=8, status=InvalidToken, id=1, cause=null)",
        "destination": "destination endpoint arn"
    }
}

Upvotes: 3

Views: 1264

Answers (1)

Tillson
Tillson

Reputation: 530

The problem ended up being that I was using a production certificate and it was all in development (building from Xcode). Switching everything to a development app in SNS fixed it.

Upvotes: 2

Related Questions