How do I troubleshoot failed Amazon SNS push notification deliveries?
Last updated: 2019-03-19
How do I confirm the delivery status of Amazon Simple Notification Service (Amazon SNS) push notifications, and how do I determine why some notifications fail?
When you enable Amazon SNS delivery status logging for your platform application, your push notification transactions are logged with Amazon CloudWatch Logs, including both successful and failed deliveries.
Turn on delivery status logging
- Open the Amazon SNS console.
- Open the left navigation menu, expand Mobile, and then choose Push notifications.
- Under Platform applications, select the platform application you want to enable delivery status for, and then choose Edit.
- Expand Delivery status logging – optional, and then choose Create new service role.
- Choose Create new roles. The AWS Identity and Access Management (IAM) console opens in a new tab or window.
- On the IAM console permission request page, choose Allow.
- Choose Save changes.
View delivery status logs
- Open the CloudWatch console.
- In the left navigation pane, choose Logs.
- Under Log Groups, find your application's delivery status logs.
Delivery status logs aren't available until messages are published to an endpoint. For push notifications, successful publication occurs when Amazon SNS hands off the message to the provider. However, that hand off does not guarantee that the notification was delivered to the device.
Depending on the application type, you might see two log groups—one for successful notifications, and one for failed notifications. Logs for Firebase Cloud Messaging (FCM) and Apple Push Notification service (APNs) are in log groups named like this example:
"Failure" is appended to a log entry if delivery is unsuccessful. For example:
Some log details include the messageId, statusCode, time taken (dwellTimeMs), destination endpoint (destination), and providerResponse. For example logs, see Amazon SNS Message Delivery Status CloudWatch Log Examples.
Troubleshoot notification failures
Look up the statusCode with the provider service, such as FCM or APNs. For the provider's exact response message, view the providerResponse.