feat(messaging): migrate topic subscriptions to FCM v1 API - #3211
Open
lahirumaramba wants to merge 4 commits into
Open
feat(messaging): migrate topic subscriptions to FCM v1 API#3211lahirumaramba wants to merge 4 commits into
lahirumaramba wants to merge 4 commits into
Conversation
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
Contributor
There was a problem hiding this comment.
Code Review
This pull request migrates the topic subscription and unsubscription management in the Firebase Messaging service to the FCM v1 API, while preserving the old behavior under deprecated legacy methods. It introduces concurrent request handling with a limit for both HTTP/1.1 and HTTP/2 transports. The review feedback highlights a potential runtime TypeError when parsing server error responses if the error field is null, and identifies an opportunity to reduce code duplication in the task mapping logic for HTTP/1.1 and HTTP/2 requests.
Migrate `subscribeToTopic` and `unsubscribeFromTopic` methods in `admin.messaging.Messaging` from legacy Instance ID (IID) endpoints (`iid.googleapis.com/iid/v1`) to the modernized single-token Firebase Cloud Messaging (FCM) v1 Topics Subscription REST API (`fcm.googleapis.com/v1`).
- Update `subscribeToTopic` (`CreateTopicSubscription`) and `unsubscribeFromTopic` (`DeleteTopicSubscription`) to use HTTP/2 transport by default (or HTTP/1.1 via `enableLegacyHttpTransport()`).
- Implement client-side concurrency pooling (`runWithConcurrencyLimit`) bounded to 100 concurrent requests per batch to avoid HTTP/2 stream exhaustion.
- Preserve idempotency by treating `ALREADY_EXISTS` (HTTP 409) as success for subscription requests, and `NOT_FOUND` (HTTP 404) as `REGISTRATION_TOKEN_NOT_REGISTERED` for unsubscription requests.
- Add legacy backup/escape-hatch methods `subscribeToTopicLegacy` and `unsubscribeFromTopicLegacy` annotated with `@deprecated Use {@link Messaging.subscribeToTopic} instead.` and `@deprecated Use {@link Messaging.unsubscribeFromTopic} instead.`.
TAG=agy
CONV=a2576aae-730b-4fb1-a151-9e6913f97be4
lahirumaramba
force-pushed
the
lm-fcm-topics
branch
from
August 25, 2026 17:59
af0393f to
817865e
Compare
lahirumaramba
marked this pull request as ready for review
August 25, 2026 18:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrate
subscribeToTopicandunsubscribeFromTopicmethods inadmin.messaging.Messagingfrom legacy Instance ID (IID) endpoints (iid.googleapis.com/iid/v1) to the modernized single-token Firebase Cloud Messaging (FCM) v1 Topics Subscription REST API (fcm.googleapis.com/v1).subscribeToTopic(CreateTopicSubscription) andunsubscribeFromTopic(DeleteTopicSubscription) to use HTTP/2 transport by default (or HTTP/1.1 viaenableLegacyHttpTransport()).runWithConcurrencyLimit) bounded to 100 concurrent requests per batch to avoid HTTP/2 stream exhaustion.ALREADY_EXISTS(HTTP 409) as success for subscription requests, andNOT_FOUND(HTTP 404) asREGISTRATION_TOKEN_NOT_REGISTEREDfor unsubscription requests.subscribeToTopicLegacyandunsubscribeFromTopicLegacyannotated with@deprecated Use {@link Messaging.subscribeToTopic} instead.and@deprecated Use {@link Messaging.unsubscribeFromTopic} instead..