The Firebase Admin SDK (Python 7.5.0) lately added a fid ship goal and deprecated token (see docs: https://firebase.google.com/docs/cloud-messaging/ship/admin-sdk#send-messages-to-specific-devices).
I am attempting to ship an FCM notification to an iOS system by its Firebase Set up ID, however each FID-targeted ship comes again 404 NOT_FOUND with errorCode: UNREGISTERED. In the very same name with the identical mission, identical OAuth token, identical message payload, concentrating on the system’s full FCM registration token as an alternative returns 200 and delivers the notification (a visual banner when the app is backgrounded).
The FID I am sending is the worth returned by the Installations API (Installations.installationID() on iOS), and it is precisely the prefix of the registration token, which has the form
The Android documentation describes an opt-in for FID-based registration (an AndroidManifest.xml flag plus the onRegistered() callback on FirebaseMessagingService), however I am unable to discover any iOS equal within the SDK or the docs. It seems to be like an iOS set up isn’t registered as a FID-addressable supply goal — so I wish to verify whether or not there’s an iOS-side step I am lacking, or whether or not FID-based supply is at the moment Android-only.
Different stuff I’ve dominated out:
-
Auth — the token-targeted ship succeeds (200) with the identical OAuth token, so it is not a credential/THIRD_PARTY_AUTH_ERROR downside.
-
Malformed request — FCM parses the fid area and returns UNREGISTERED, not 400 INVALID_ARGUMENT, so the sector is accepted and actively resolved.
-
Shopper implementation — reproduced identically on a local Swift app (FirebaseMessaging) and a React Native Firebase app.
-
SDK model — reproduced on firebase-ios-sdk 11.15.0 and on the most recent 12.15.0, together with on a freshly deleted-and-recreated set up.
-
Registration / APNs setup — the app registers for distant notifications and getToken() succeeds; APNs might be configured appropriately (token-targeted sends ship a visual banner).
-
The migration fallback — placing the naked FID within the token area (the “token area additionally accepts FIDs” path) additionally returns UNREGISTERED.
-
A stale/reused set up — a brand-new set up minted by the most recent SDK behaves the identical.
Minimal Repro
$OAUTH is a short-lived entry token minted from the service account (scope: https://www.googleapis.com/auth/firebase.messaging). The 2 requests are an identical apart from the goal area!
URL="https://fcm.googleapis.com/v1/initiatives/my-project/messages:ship"
# (A) goal = fid -> FAILS
curl -s -X POST "$URL"
-H "Authorization: Bearer $OAUTH" -H "Content material-Sort: software/json"
-d '{"message":{"fid":"cAbCdEfGhIjKlMnOpQrStU","notification":{"title":"t","physique":"b"}}}'
# -> 404
# {"error":{"code":404,"message":"NotRegistered","standing":"NOT_FOUND",
# "particulars":[{"@type":"type.googleapis.com/google.firebase.fcm.v1.FcmError",
# "errorCode":"UNREGISTERED"}]}}
# (B) goal = token -> DELIVERS
curl -s -X POST "$URL"
-H "Authorization: Bearer $OAUTH" -H "Content material-Sort: software/json"
-d '{"message":{"token":"cAbCdEfGhIjKlMnOpQrStU:APA91b_EXAMPLE_APNS_SUFFIX","notification":{"title":"t","physique":"b"}}}'
# -> 200
# {"identify":"initiatives/my-project/messages/1234567890"}
