Better handling of invalid registration token?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu từ đường dẫn messaging.send và kiểm tra cách InvalidArgumentError, SenderIdMismatchError và UnregisteredError hiện đang được phát sinh. Theo dõi việc xử lý phản hồi HTTP cho trường hợp “Invalid registration token” và xác định hành vi lỗi công khai cần thiết. Hoàn thành khi các bên gọi có thể xử lý tình huống token không hợp lệ này mà không cần kiểm tra các chi tiết nội bộ của HTTP, đồng thời đường dẫn lỗi liên quan có kiểm thử bao phủ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[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?
- Ngôn ngữ chính
- Python
- Star
- 1.2k
- Fork
- 359
- Merge trung bình
- 5 ngày 6 phút
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của firebase/firebase-admin-python
-
api: remoteconfig
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
firebase/firebase-admin-python#957 · 1 bình luận ·
-
api: database type: feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
firebase/firebase-admin-python#978 · 1 bình luận ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) Đang mởapi: auth
firebase/firebase-admin-python#949 · 2 bình luận · 1 reaction · 1 người được giao ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 43/100
firebase/firebase-admin-python#945 · 1 bình luận · 1 reaction ·
Tất cả issue của firebase/firebase-admin-python
Issue tương tự
-
triage/confirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
apache/cloudstack#14222 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100