Skip to content

Commit 2ac51c2

Browse files
jonathanedeylahirumaramba
authored andcommitted
fix(fcm): Map topic subscription RESOURCE_EXHAUSTED server code to new TOPICS_SUBSCRIPTION_RATE_EXCEEDED SDK error code (#3148)
* fix(fcm): Map `RESOURCE_EXHAUSTED` server code to new `TOPICS_SUBSCRIPTION_RATE_EXCEEDED` SDK error code * fix: Update apidocs * fix: Address gemini review * fix: Apply TW review changes
1 parent e4fb88a commit 2ac51c2

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

etc/firebase-admin.messaging.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export const MessagingErrorCode: {
211211
readonly INVALID_PACKAGE_NAME: "invalid-package-name";
212212
readonly DEVICE_MESSAGE_RATE_EXCEEDED: "device-message-rate-exceeded";
213213
readonly TOPICS_MESSAGE_RATE_EXCEEDED: "topics-message-rate-exceeded";
214+
readonly TOPICS_SUBSCRIPTION_RATE_EXCEEDED: "topics-subscription-rate-exceeded";
214215
readonly MESSAGE_RATE_EXCEEDED: "message-rate-exceeded";
215216
readonly THIRD_PARTY_AUTH_ERROR: "third-party-auth-error";
216217
readonly TOO_MANY_TOPICS: "too-many-topics";

src/messaging/error.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const MessagingErrorCode = {
3434
INVALID_PACKAGE_NAME: 'invalid-package-name',
3535
DEVICE_MESSAGE_RATE_EXCEEDED: 'device-message-rate-exceeded',
3636
TOPICS_MESSAGE_RATE_EXCEEDED: 'topics-message-rate-exceeded',
37+
TOPICS_SUBSCRIPTION_RATE_EXCEEDED: 'topics-subscription-rate-exceeded',
3738
MESSAGE_RATE_EXCEEDED: 'message-rate-exceeded',
3839
THIRD_PARTY_AUTH_ERROR: 'third-party-auth-error',
3940
TOO_MANY_TOPICS: 'too-many-topics',
@@ -112,6 +113,12 @@ export const messagingClientErrorCode: { readonly [K in keyof typeof MessagingEr
112113
'high. Reduce the number of messages sent for this topic, and do not immediately retry sending ' +
113114
'to this topic.',
114115
},
116+
TOPICS_SUBSCRIPTION_RATE_EXCEEDED: {
117+
code: MessagingErrorCode.TOPICS_SUBSCRIPTION_RATE_EXCEEDED,
118+
message: 'The rate of subscription management requests to a particular topic is too ' +
119+
'high. Reduce the number of requests sent for this topic, and do not immediately retry the ' +
120+
'request.',
121+
},
115122
MESSAGE_RATE_EXCEEDED: {
116123
code: MessagingErrorCode.MESSAGE_RATE_EXCEEDED,
117124
message: 'Sending limit exceeded for the message target.',
@@ -207,7 +214,7 @@ const TOPIC_MGT_SERVER_TO_CLIENT_CODE: Record<string, keyof typeof MessagingErro
207214
NOT_FOUND: 'REGISTRATION_TOKEN_NOT_REGISTERED',
208215
INVALID_ARGUMENT: 'INVALID_REGISTRATION_TOKEN',
209216
TOO_MANY_TOPICS: 'TOO_MANY_TOPICS',
210-
RESOURCE_EXHAUSTED: 'TOO_MANY_TOPICS',
217+
RESOURCE_EXHAUSTED: 'TOPICS_SUBSCRIPTION_RATE_EXCEEDED',
211218
PERMISSION_DENIED: 'AUTHENTICATION_ERROR',
212219
DEADLINE_EXCEEDED: 'SERVER_UNAVAILABLE',
213220
INTERNAL: 'INTERNAL_ERROR',

0 commit comments

Comments
 (0)