├ 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

reasontokenInvalidaction
BadDeviceTokentrueRemove the token. The device unregistered or the token is malformed.
UnregisteredtrueRemove the token. The device was wiped or the app was uninstalled.
DeviceTokenNotForTopictrueRemove the token. It belongs to a different app (bundle ID mismatch).
PayloadTooLargefalseReduce your payload size (4096 byte APNs limit).
TooManyRequestsfalseBack off. Apple is rate-limiting your sends to this device.
InternalServerErrorfalseRetry. Transient APNs failure.
ServiceUnavailablefalseRetry. APNs is temporarily down.
ExpiredProviderTokenfalseYour .p8 key may be revoked. Check the credential health panel.
InvalidProviderTokenfalseTeam ID, key ID, or .p8 key is wrong. Re-upload the credential.
TopicDisallowedfalseThe bundle ID is not authorized for push. Check your Apple Developer portal.

FCM error codes

reasontokenInvalidaction
NOT_FOUNDtrueRemove the token. The registration no longer exists.
UNREGISTEREDtrueRemove the token. The app was uninstalled.
INVALID_ARGUMENTtrueThe token is malformed. Remove it.
PERMISSION_DENIEDfalseThe service account lost cloud messaging permissions. Re-check IAM.
UNAVAILABLEfalseRetry. FCM is temporarily overloaded.
INTERNALfalseRetry. Transient FCM failure.
QUOTA_EXCEEDEDfalseBack off. You hit FCM per-project rate limit.
SENDER_ID_MISMATCHfalseThe token was registered under a different Firebase project.