Better handling of invalid registration token?
まだ誰も着手していません。
評価
調査の方向性
messaging.send パスから開始し、InvalidArgumentError、SenderIdMismatchError、UnregisteredError が現在どのように発生させられているかを調査します。「Invalid registration token」のケースに対する HTTP レスポンス処理を追跡し、必要な公開エラーの動作を特定します。呼び出し側が HTTP の内部を調べずにこの無効なトークンのシナリオを処理でき、関連するエラーパスがテストでカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
[READ] Step 1: Are you in the right place?
Looks like it.
[REQUIRED] Step 2: Describe your environment
- Operating System version: Any
- Firebase SDK version: v6.5.0
- Firebase Product: FCM
- Python version: 3.11.9
- Pip version: Any
[REQUIRED] Step 3: Describe the problem
This looks similar to #187, but that's been closed for years, so the similarity might no longer apply.
The crux of the issue is that not all scenarios of invalid registration IDs in FCM are supported equally. Particularly, there is the case of InvalidArgumentError due to an invalid registration ID which forces us to inspect the underlying HTTPError.
In other words, for us to handle all (known) scenarios where we should drop a particular registration ID, we currently have to:
try:
messaging.send(message)
except (
messaging.SenderIdMismatchError,
messaging.UnregisteredError,
messaging.ThirdPartyAuthError,
):
# Handle errors that require dropping the registration ID
# This is reasonably ergonomic!
pass
except exceptions.InvalidArgumentError as e:
if e.http_response and "Invalid registration token" in e.http_response.text:
# Handle errors that require dropping the registration ID
# This is NOT ergonomic! Plus it relies on API internals not abstracted away by `firebase-admin-sdk`.
pass
Is there any chance for first-party support of this error? Perhaps by re-raising as messaging.InvalidRegistrationIdError?
- 主要言語
- Python
- スター
- 1.2k
- フォーク
- 359
- 平均マージ
- 5日 6分
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
firebase/firebase-admin-python のほかの issue
-
api: remoteconfig
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
firebase/firebase-admin-python#957 · コメント 1 件 ·
-
api: database type: feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
firebase/firebase-admin-python#978 · コメント 1 件 ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) オープンapi: auth
firebase/firebase-admin-python#949 · コメント 2 件 · リアクション 1 件 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 43/100
firebase/firebase-admin-python#945 · コメント 1 件 · リアクション 1 件 ·
firebase/firebase-admin-python の issue をすべて見る
似ている issue
-
triage/confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
NousResearch/hermes-agent#118866 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
apache/cloudstack#14222 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100