From 7709b5aa5af355df0c53b2fc9ea40bac06b41781 Mon Sep 17 00:00:00 2001 From: jonathanedey Date: Thu, 14 May 2026 12:44:26 -0400 Subject: [PATCH 1/4] fix(fcm): Map `RESOURCE_EXHAUSTED` server code to new `TOPICS_SUBSCRIPTION_RATE_EXCEEDED` SDK error code --- src/messaging/error.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/messaging/error.ts b/src/messaging/error.ts index 2ac251305a..e095e0606a 100644 --- a/src/messaging/error.ts +++ b/src/messaging/error.ts @@ -34,6 +34,7 @@ export const MessagingErrorCode = { INVALID_PACKAGE_NAME: 'invalid-package-name', DEVICE_MESSAGE_RATE_EXCEEDED: 'device-message-rate-exceeded', TOPICS_MESSAGE_RATE_EXCEEDED: 'topics-message-rate-exceeded', + TOPICS_SUBSCRIPTION_RATE_EXCEEDED: 'topics-subscription-rate-exceeded', MESSAGE_RATE_EXCEEDED: 'message-rate-exceeded', THIRD_PARTY_AUTH_ERROR: 'third-party-auth-error', TOO_MANY_TOPICS: 'too-many-topics', @@ -112,6 +113,12 @@ export const messagingClientErrorCode: { readonly [K in keyof typeof MessagingEr 'high. Reduce the number of messages sent for this topic, and do not immediately retry sending ' + 'to this topic.', }, + TOPICS_SUBSCRIPTION_RATE_EXCEEDED: { + code: MessagingErrorCode.TOPICS_SUBSCRIPTION_RATE_EXCEEDED, + message: 'The rate of subscription requests to a particular topic is too ' + + 'high. Reduce the number of requests sent for this topic, and do not immediately retry subscribing ' + + 'to this topic.', + }, MESSAGE_RATE_EXCEEDED: { code: MessagingErrorCode.MESSAGE_RATE_EXCEEDED, message: 'Sending limit exceeded for the message target.', @@ -207,7 +214,7 @@ const TOPIC_MGT_SERVER_TO_CLIENT_CODE: Record Date: Fri, 15 May 2026 12:34:48 -0400 Subject: [PATCH 2/4] fix: Update apidocs --- etc/firebase-admin.messaging.api.md | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/firebase-admin.messaging.api.md b/etc/firebase-admin.messaging.api.md index 4c13ff1d27..7a6224ba90 100644 --- a/etc/firebase-admin.messaging.api.md +++ b/etc/firebase-admin.messaging.api.md @@ -217,6 +217,7 @@ export const MessagingErrorCode: { readonly INVALID_PACKAGE_NAME: "invalid-package-name"; readonly DEVICE_MESSAGE_RATE_EXCEEDED: "device-message-rate-exceeded"; readonly TOPICS_MESSAGE_RATE_EXCEEDED: "topics-message-rate-exceeded"; + readonly TOPICS_SUBSCRIPTION_RATE_EXCEEDED: "topics-subscription-rate-exceeded"; readonly MESSAGE_RATE_EXCEEDED: "message-rate-exceeded"; readonly THIRD_PARTY_AUTH_ERROR: "third-party-auth-error"; readonly TOO_MANY_TOPICS: "too-many-topics"; From f760b81fc4a55df3e281fffc1333e869f939f290 Mon Sep 17 00:00:00 2001 From: jonathanedey Date: Fri, 15 May 2026 13:37:14 -0400 Subject: [PATCH 3/4] fix: Address gemini review --- src/messaging/error.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/messaging/error.ts b/src/messaging/error.ts index e095e0606a..e982b29106 100644 --- a/src/messaging/error.ts +++ b/src/messaging/error.ts @@ -115,9 +115,9 @@ export const messagingClientErrorCode: { readonly [K in keyof typeof MessagingEr }, TOPICS_SUBSCRIPTION_RATE_EXCEEDED: { code: MessagingErrorCode.TOPICS_SUBSCRIPTION_RATE_EXCEEDED, - message: 'The rate of subscription requests to a particular topic is too ' + - 'high. Reduce the number of requests sent for this topic, and do not immediately retry subscribing ' + - 'to this topic.', + message: 'The rate of subscription management requests to a particular topic is too ' + + 'high. Reduce the number of requests sent for this topic, and do not immediately retry the ' + + 'request for this topic.', }, MESSAGE_RATE_EXCEEDED: { code: MessagingErrorCode.MESSAGE_RATE_EXCEEDED, From 70cc0d03eeda3b7f58c43fbb3dcb53a984ee7838 Mon Sep 17 00:00:00 2001 From: jonathanedey Date: Fri, 15 May 2026 14:05:20 -0400 Subject: [PATCH 4/4] fix: Apply TW review changes --- src/messaging/error.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/messaging/error.ts b/src/messaging/error.ts index e982b29106..799cc44afc 100644 --- a/src/messaging/error.ts +++ b/src/messaging/error.ts @@ -117,7 +117,7 @@ export const messagingClientErrorCode: { readonly [K in keyof typeof MessagingEr code: MessagingErrorCode.TOPICS_SUBSCRIPTION_RATE_EXCEEDED, message: 'The rate of subscription management requests to a particular topic is too ' + 'high. Reduce the number of requests sent for this topic, and do not immediately retry the ' + - 'request for this topic.', + 'request.', }, MESSAGE_RATE_EXCEEDED: { code: MessagingErrorCode.MESSAGE_RATE_EXCEEDED,