Step #11 Error: "Unable to get messaging token. FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope..."
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- firebase, javascript
- Lĩnh vực
- web-dev
Hướng nghiên cứu
Tái hiện Bước 11 cục bộ trong Chrome và kiểm tra việc đăng ký web-start\public\firebase-messaging-sw.js, tệp này có thể truy cập tại /firebase-messaging-sw.js. So sánh thiết lập Firebase Messaging của codelab với FirebaseError đã được báo cáo và xác minh rằng service worker mặc định được đăng ký và console in ra token thiết bị FCM.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[REQUIRED] Codelab info
https://codelabs.developers.google.com/codelabs/firebase-web/#10
I encountered this problem on "Step 11. Show notifications"
[REQUIRED] Project setup
As instructed, I've created firebase-messaging-sw.js in web-start\public. Ie. Loading this works for me:
http://localhost:5000/firebase-messaging-sw.js
I am working on localhost in Chrome Version 87.0.4280.88 (Official Build) (64-bit).
[REQUIRED] Describe the problem
On Step 11, I am currently on the step: "Get your device token." But after I refresh my browser (Chrome) and allow notifications, I am getting this error in the console:

Per the codelab tutorial, after clicking "Allow" (notifications in the browser), I was expecting in my console:
4. Open the JavaScript console of your browser. You should see the following message: Got FCM device token: cWL6w:APA91bHP...4jDPL_A-wPP06GJp1OuekTaTZI5K2Tu
What I've tried:
I saw there was a previous closed issue: https://github.com/firebase/codelab-friendlychat-web/issues/208
I've tried copying my firebaseConfig var and manually initializing it again but it didn't work for me. Ie. This didn't work for me:

PS. Obviously, I went to my Firebase project console and copied over my actual project parameters. Ie. The javascript object given under:

The only other change was in the codelab, in firebase-messaging-sw.js the firebase versions were hardcoded to 6.0.4 but I went ahead and updated those to 8.2.2.
[Optional] Suggested fix
Unsure. Please help. Thank you! Everything else in the codelab was terrific so far. I know I'm a decade late to Firebase but this is amazing! Thank you for putting it together! 🙏🙏🙏
- Ngôn ngữ chính
- JavaScript
- Star
- 1.9k
- Fork
- 1.8k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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/codelab-friendlychat-web
-
Codelab freindly chat website.Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
-
RunĐang mởbug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
firebase/codelab-friendlychat-web#877 · 2 bình luận ·
-
Go to '...'Đang mởbug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
-
CameraĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Sifsin projectĐang mởbug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
firebase/codelab-friendlychat-web#837 · 1 reaction ·
Tất cả issue của firebase/codelab-friendlychat-web
Issue tương tự
-
Quick Connect form is off-centerĐang mởbug
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
jellyfin/jellyfin-web#8865 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
renderer.44: a zoom out cannot keep the center and stay inside data.range at an end of the dataĐang mởarea:contract P3
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
grafana/viz-contract#100 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SUB-1: [CI] Update deprecated CodeQL Action v2 to v4Có thể đã có người làm @AnkitSatpute đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
-
The model name in the conversation header is truncated to "Qwen3…" with free space beside itĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100