How do I troubleshoot Firebase Cloud Messaging (FCM) mobile push notification failures in Amazon SNS?

3 minute read
0

My Firebase Cloud Messaging (FCM) mobile push notifications are failing to send through Amazon Simple Notification Service (Amazon SNS). How do I troubleshoot the issue?

Resolution

Configure and view push notification delivery status attributes for Amazon CloudWatch Logs

Follow the instructions in How do I access Amazon SNS topic delivery logs for push notifications?

Verify if you can receive notification's directly from FCM

To see if the issue is on the Amazon SNS endpoint's side or the client application's side, send a test message on the FCM console. For instructions, see Send a notification message (for iOS) or Send a test notification message (for Android) in the FCM documentation.

After you send the test notification, the FCM console displays a panel that provides the test notification results. If you don't receive the notification, then follow the instructions in the Confirm that you're using the correct FCM message type section of this article.

Verify if the platform endpoint associated with the device that's not receiving push notifications is activated

1.    Review your delivery status logs for failed push notification deliveries ("status": "FAILURE").

2.    Check the failed push notification delivery logs for the following value: "providerResponse": "Endpoint is disabled". If you see this value in the failed delivery logs, then the platform endpoint associated with the device that's not receiving push notifications is deactivated.

3.    If the platform endpoint is deactivated, reactivate it by running the SetEndpointAttributes API action. Running the SetEndpointAttributes API action associates the endpoint with the latest valid device token.

Note: For more information, see Re-enabling a platform endpoint associated with an invalid device token in the Troubleshooting section of Creating a platform endpoint.

Failed FCM push notification delivery CloudWatch log event example

{
  "notification": {
    "messageMD5Sum": "c8c339cf07dc39c9388253dgc81f257",
    "messageId": "fg207f98-0244-6767-96e2-45b1fg451gg8",
    "timestamp": "2021-05-25 22:27:51.889"
  },
  "delivery": {
    "deliveryId": "76ab7dcd-f444-5b4f-9d1b-24ea8863d9bc",
    "destination": "arn:aws:sns:us-east-1:123456789101:endpoint/GCM/MyAndroidApp/682dc992-a47f-45f7-b980-97727cce0a9c",
    "providerResponse": "Endpoint is disabled",
    "dwellTimeMs": 28,
    "attempts": 1,
    "token": "ojnco9nc9weucn9encx9ewunc9nu9w9euncec9necn9xexnexex9encewcerve0f0o0dmco9j",
    "statusCode": 400
  },
  "status": "FAILURE"
}

Confirm that you're using the correct FCM message type

Note: FCM supports two types of messages: Notification messages and Data messages. Notification messages are handled by the FCM SDK automatically. Data messages are handled by the client app. For more information, see Message types in the FCM documentation and Sending platform-specific messages in the Amazon SNS Developer Guide.

If you're processing message data on your client app

Make sure that you use Data messages. For more information, see Data messages in the FCM documentation.

If you want the FCM SDK to handle displaying notifications on your client app's behalf

Make sure that you use Notification messages. For more information, see Notification messages in the FCM documentation.

Identify and troubleshoot any FCM error response codes

1.    Review your delivery status logs for failed push notification deliveries ("status": "FAILURE").

2.    Check the failed push notification delivery logs for any other platform response codes. Then, follow the Recommended Action listed for that code in the Downstream message error response codes section of the FCM documentation.

Note: For more information on FCM error codes and troubleshooting best practices, see ErrorCode in the FCM documentation.


Related information

Monitoring Amazon SNS topics using CloudWatch

Mobile push notifications

AWS OFFICIAL
AWS OFFICIALUpdated a year ago