├  12

error codes

When a push fails, the receipt's error field contains the reason code from APNs or FCM. The tokenInvalid boolean flags tokens you should remove from your database.

APNs error codes

reason tokenInvalid action
BadDeviceToken true Remove the token. The device unregistered or the token is malformed.
Unregistered true Remove the token. The device was wiped or the app was uninstalled.
DeviceTokenNotForTopic true Remove the token. It belongs to a different app (bundle ID mismatch).
PayloadTooLarge false Reduce your payload size (4096 byte APNs limit).
TooManyRequests false Back off. Apple is rate-limiting your sends to this device.
InternalServerError false Retry. Transient APNs failure.
ServiceUnavailable false Retry. APNs is temporarily down.
ExpiredProviderToken false Your .p8 key may be revoked. Check the credential health panel.
InvalidProviderToken false Team ID, key ID, or .p8 key is wrong. Re-upload the credential.
TopicDisallowed false The bundle ID is not authorized for push. Check your Apple Developer portal.

FCM error codes

reason tokenInvalid action
NOT_FOUND true Remove the token. The registration no longer exists.
UNREGISTERED true Remove the token. The app was uninstalled.
INVALID_ARGUMENT true The token is malformed. Remove it.
PERMISSION_DENIED false The service account lost cloud messaging permissions. Re-check IAM.
UNAVAILABLE false Retry. FCM is temporarily overloaded.
INTERNAL false Retry. Transient FCM failure.
QUOTA_EXCEEDED false Back off. You hit FCM per-project rate limit.
SENDER_ID_MISMATCH false The token was registered under a different Firebase project.