Can we access your project?
Current Behavior
With Push Notifications enabled and deployed, the Cloud FunctionaddFcmToken(HTTP, v1) receives traffic. Each registration results in a new document under users/{uid}/fcm_tokens with a random document ID, so one user accumulates many token documents over time (e.g. after TestFlight reinstalls or token refresh).
Downstream, only the “first” or an arbitrary token may be used unless the backend explicitly picks the newest document. Push delivery can fail or target the wrong install even though FCM/APNs are configured correctly.
Expected Behavior
FCM token storage should update a single document per user (or one per device with a stable ID), e.g. set/merge on a fixed path like users/{uid}/fcm_tokens/default or users/{uid}/fcm_tokens/{deviceId}, instead of add() with a new auto-ID on every registration.
Alternatively, FlutterFlow should document the intended behavior and provide a supported way to avoid unbounded growth of fcm_tokens subcollections.
Steps to Reproduce
- Create/use a FlutterFlow project with Firebase and Push Notifications enabled and Deployed (so
addFcmToken and related infra exist).
- Sign in as a user so the app registers FCM and calls token registration (as FlutterFlow does on launch / after permission).
- In Firestore, open
users/{uid}/fcm_tokens and note document IDs.
- Trigger token registration again (e.g. reinstall the app from TestFlight, or clear app data and open again, or wait for token refresh if applicable).
- Open
users/{uid}/fcm_tokens again and observe additional documents with new random IDs instead of updating the same document.
- In Google Cloud Console → Cloud Functions, confirm
addFcmToken shows repeated invocations corresponding to these registrations.
Reproducible from Blank
Bug Report Code (Required)
ITEShsmAz4Zgru4E+pfbY+5QhQIgQ0QnU7gnlO1ucx40GJDpPJoIfs/BaUNKQteFTFVMIFH8pEAywt7LvdrAGMIqJU+bc5xZ0JVAVhaVbDqlb6qoCLmKYHMmBdJXJ0CFyLunnhBTBO1oWnBg12atNq3qNleeY8aSfxBlZ7vfcPo=
Visual documentation
i removed the docs in order to get the notifications to work...
Environment
- FlutterFlow version: [e.g. v5.x – from FlutterFlow UI]
- Platform: [Web builder / macOS app – whichever you use]
- Browser name and version: [e.g. Chrome 131]
- Operating system and version: [e.g. macOS 15.x]
- Affected app: **iOS** (TestFlight)
Additional Information
We confirmed FCM + APNs work when targeting the *correct registration token (e.g. Firebase console test). The problem is multiple stored tokens and non-deterministic which doc backend logic reads first.
We mitigated server-side by preferring the newest created_at under fcm_tokens, but the root issue appears to be how addFcmToken writes to Firestore (likely add vs set/merge). Requesting clarification on intended behavior and a supported pattern for one doc per user/device.
Can we access your project?
Current Behavior
With Push Notifications enabled and deployed, the Cloud Function
addFcmToken(HTTP, v1) receives traffic. Each registration results in a new document underusers/{uid}/fcm_tokenswith a random document ID, so one user accumulates many token documents over time (e.g. after TestFlight reinstalls or token refresh).Downstream, only the “first” or an arbitrary token may be used unless the backend explicitly picks the newest document. Push delivery can fail or target the wrong install even though FCM/APNs are configured correctly.
Expected Behavior
FCM token storage should update a single document per user (or one per device with a stable ID), e.g.
set/mergeon a fixed path likeusers/{uid}/fcm_tokens/defaultorusers/{uid}/fcm_tokens/{deviceId}, instead ofadd()with a new auto-ID on every registration.Alternatively, FlutterFlow should document the intended behavior and provide a supported way to avoid unbounded growth of
fcm_tokenssubcollections.Steps to Reproduce
addFcmTokenand related infra exist).users/{uid}/fcm_tokensand note document IDs.users/{uid}/fcm_tokensagain and observe additional documents with new random IDs instead of updating the same document.addFcmTokenshows repeated invocations corresponding to these registrations.Reproducible from Blank
Bug Report Code (Required)
ITEShsmAz4Zgru4E+pfbY+5QhQIgQ0QnU7gnlO1ucx40GJDpPJoIfs/BaUNKQteFTFVMIFH8pEAywt7LvdrAGMIqJU+bc5xZ0JVAVhaVbDqlb6qoCLmKYHMmBdJXJ0CFyLunnhBTBO1oWnBg12atNq3qNleeY8aSfxBlZ7vfcPo=
Visual documentation
i removed the docs in order to get the notifications to work...
Environment
Additional Information
We confirmed FCM + APNs work when targeting the *correct registration token (e.g. Firebase console test). The problem is multiple stored tokens and non-deterministic which doc backend logic reads first.
We mitigated server-side by preferring the newest
created_atunderfcm_tokens, but the root issue appears to be howaddFcmTokenwrites to Firestore (likelyaddvsset/merge). Requesting clarification on intended behavior and a supported pattern for one doc per user/device.