Debugging Ably Push Notifications

If you aren't receiving expected Push Notifications on your device, this can be due various reasons. You'll need to figure out if it's an issue on Ably's side or some issue with your device's registration with FCM/APNS. 

The following steps can help you get a better idea of what may be happening:

1. Find your device's identifier (deviceId, clientId, etc)

In the Ably dashboard, go to the Notifications tab and use the device inspector to inspect that device ID.

If the state is FAILED an error should also be displayed. 

The most common error is registration expired where the user uninstalled the app or disabled notifications.

If the device is ACTIVE then you can use the push inspector to test notifications to a device:

 

2. Use Ably's REST API to publish a push notification directly to your device using the 'deviceId'  (or any other supported identifier) to see if this part of the message flow is working

 

3. You can also look at the stats within the Notifications section on your Ably app dashboard to understand if the push notifications are successfully was delivered at all from Ably.

4. You can look for any push related errors via the Ably dev console to inspect the logs at the time or you can subscribe to the [meta]log:push channel instead.

From any errors there you should see an FCM or APNS reason why the notification failed. If no logs are raised it means the notification succeeded.


If this is working normally, then the issue is most likely with your native notification provider i.e FCM/APNS.

Specific errors

APNs

BadDeviceToken - In this case, the device token is invalid. Make sure the environment for push notifications on the app (Runner.entitlements) matches the environment set in Ably dashboards push notification tab.
When running a debug application, the sandbox / development APNs server is used. Make sure to use an application with Use APNS sandbox environment? enabled in the Ably dashboard (push notification tab). Changing the aps-environment value in the .entitlements file to production does not make the debug application use the production APNs server.

FCM

FcmTransport not configured -  In this case the json file uploaded is not in the expected format of a service account key file. Please check the steps required on the configuring android documentation.

403 Forbidden - In this case it could mean that the firebase cloud messaging API is not enabled in your FCM project. Check that the Firebase cloud messaging API (V1) is enabled under the FCM projects cloud messaging tab. It could also mean the service account used does not have the correct permissions

404 Not Found - In this case it is usually that the device is unregistered for push with FCM. This can happen if the app is uninstalled on the device and therefore deactivate has never been called and the registration remains on Ably. You can check a list of registered devices via the REST API or push admin from an Ably SDK