Firebase Messaging returning "Invalid registration token" when sending silent APNs notification
See original GitHub issue[REQUIRED] Step 2: Describe your environment
- Operating System version: MacOS Big Sur
- Firebase SDK version: 9.6.0 (Firebase Admin version)
- Firebase Product: messaging
- Node.js version: 12
- NPM version: 6.14.12
[REQUIRED] Step 3: Describe the problem
FCM started responding with INVALID_ARGUMENT
with a description of Invalid registration token
to any calls for sending APNs silent notifications. We’ve verified that the tokens are actually valid. This happens in the node client, and also when calling directly the HTTP v1 send endpoint.
We started noticing this behavior roughly on 2021-04-08 14:30:00 ET, which suspiciously coincides with a deploy of our production functions. Note that this deploy didn’t include any updates to the relevant codepaths nor libraries involved.
We also found someone with the very same problem on Stack Overflow: https://stackoverflow.com/questions/67051941/fcm-throwing-invalid-argument-for-ios-notifications
Steps to reproduce:
Call the HTTP v1 send endpoint:
POST https://fcm.googleapis.com/v1/{parent=projects/*}/messages:send
with the following payload:
{
"validate_only": false,
"message": {
"token": <FCM TOKEN>,
"apns": {
"payload": {
"aps": {
"content-available": 1
}
}
}
}
}
with a valid FCM token and you should receive the following response:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "INVALID_ARGUMENT"
},
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "message.token",
"description": "Invalid registration token"
}
]
}
]
}
}
But if you replace content-available
with badge
, the notification is sent correctly:
{
"name": "projects/<PROJECT_ID>/messages/<MESSAGE_ID>"
}
We’ve also tried sending content_available
and contentAvailable
as keys, and true
as value, to no avail.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:19
- Comments:15 (1 by maintainers)
Latest update: FCM backend performed a fast rollback today. The backend should be at the good version without this issue now.
This has been forwarded to the FCM backend team. They are looking into it. We’ll post an update when new information is available.