FCM: Sending notifications to old tokens on web platform
メンテナーはふだん 7 日以内に返信
@chong-shao がすでに取り組んでいます。
2025年2月24日 から。
評価
この issue はまだ評価されていません。
説明
I’m using Flutter in my client app to handle notifications. I retrieve the token from the device, and for testing purposes, I’ve created a Firebase Cloud Function that accepts the token and sends a test notification to the browser. The function is as follows:
exports.sendNotification = functions.https.onRequest(async (_, response) => {
const message = {
notification: {
title: 'Title',
body: 'Body',
},
token: 'token',
};
try {
await admin.messaging().send(message);
response.status(200).send('Notification sent successfully');
} catch (error) {
console.error('Error sending notification:', error);
// Delete token for user if error code is UNREGISTERED or INVALID_ARGUMENT.
if (error.code == "messaging/registration-token-not-registered") {
// If you're running your own server, call API to delete the
// token for the user
console.log('Token is no longer valid: ', message.token);
}
response.status(500).send('Error sending notification: ' + error);
}
});
This function is running in the Firebase emulator.
Workflow:
- Run the web application and retrieve the notification token.
- Call the sendNotification function using the token, and everything works as expected—the notification is successfully sent to the browser.
- Close my Flutter app and reopen it, generating a new token.
- Attempt to send a notification using the old token.
Observed Behavior:
- On the web, the notifications are still sent successfully with the old token, even after the app is reopened and the token changes.
- On Android, using an old token correctly triggers the messaging/registration-token-not-registered error code, and the function logs that the token is no longer valid.
Shouldn't the behavior be consistent across web and Android? Is there a specific reason why notifications are still being sent to old tokens on the web platform?
- 主要言語
- TypeScript
- スター
- 1.8k
- フォーク
- 420
- 平均マージ
- 5日 6時間
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
firebase/firebase-admin-node のほかの issue
-
Password policy violation is reported as `auth/internal-error` instead of a specific error codeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
firebase/firebase-admin-node#3265 ·
メンテナーはふだん 7 日以内に返信
-
getToken() replays a failed token refresh to later callers while a valid token is cached対応中かも @GUMBOKIM が 51 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
firebase/firebase-admin-node#3234 ·
メンテナーはふだん 7 日以内に返信
-
[email protected] stable dependency tree fails npm audit via Storage uuid and Firestore google-gax対応中かも @lahirumaramba が 27 日前に担当しました。 オープン
firebase/firebase-admin-node#3221 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 7 日以内に返信
-
Misleading error message for THIRD_PARTY_AUTH_ERROR: raw "OAuth 2 access token" text surfaced instead of the APNs-specific message対応中かも @milcho0604 が 53 日前に担当しました。 オープンapi: messaging
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
firebase/firebase-admin-node#3215 ·
メンテナーはふだん 7 日以内に返信
-
api: messaging
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
firebase/firebase-admin-node#3214 ·
メンテナーはふだん 7 日以内に返信
firebase/firebase-admin-node の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
solana-foundation/solana-com#2245 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
`document.cookie` with `max-age=0` does not delete the cookie対応中かも @BartInTheField が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
capricorn86/happy-dom#2460 ·
メンテナーはふだん 2 日以内に返信