Unable to send notification to chrome with data.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- firebase, javascript, python
Hướng nghiên cứu
Start by comparing the manifest.json sender ID, the sw.js push handler, and the main.js subscription flow with the pywebpush calls shown in the report. Review the linked VAPID and pywebpush references alongside the FCM error response. Done means the supported credential and payload path for delivering data to Chrome is documented or reproduced with a focused test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm trying to send push notification that contains some data to chrome using FCM.
I'm using firebase console and credentials copied from it to generate a push notification

The chrome code looks like this:
manifest.json:
{
"name": "PyChat Push Notification",
"short_name": "PyPush",
"start_url": "/",
"display": "standalone",
"gcm_sender_id": "620421656154"
}
sw.js:
self.addEventListener('push', (e: any) => e.waitUntil(getPlayBack(e)));
main.js:
await webpackServiceWorker.register( {scope: '/'}) ;
let subscription = await this.serviceWorkerRegistration.pushManager.subscribe({userVisibleOnly: true});
sendToServer( subscription.toJSON())
I can successfully send a push notification W/O any data using
from pywebpush import webpush, WebPusher
WebPusher(registration_id_from_browser).send("asd", gcm_key=server_key_from_image_above)
WIth the current method, in the data field in event is null on service worker. If I understood correctly this data needs to be encrypted using VAPID otherwise firebase replaces it with null. So my attempt looks like this:
vapid_data = {'privateKey': 'COPIED_PRIVATE_KEY_FROM_FIREBASE_MAGE_ABOVE', 'publicKey': 'COPIED_PUBLIC_KEY_FROM_IMAGE_ABOVE'}
webpush(
registration_id_from_the_browser,
'Your Push Payload Text',
vapid_private_key=vapid_data['privateKey'],
vapid_claims={"sub": "mailto:[email protected]", 'aud': 'https://fcm.googleapis.com'}
)
But i'm getting
Response body:the key in the authorization header does not correspond to the sender ID used to subscribe this user. Please ensure you are using the correct sender ID and server Key from the Firebase console.
I also tried to put server_key copied from firebase console (the image) but the error is still the same.
I feel kinda confused at the end of the day since I read a lot of topics like this and this and this and this and this and this and also using PyFCM library and nothing seems to work.
Could someone please clarify:
- is FCM and GCM are the same?
- If google announced that GCM are no longer supported a few years ago, why my FCM messages still work w/o data, as I use
gcm_sender_idin manifest.json. - If vapid is required to send push messages, Should I copy private key form FCM console or generate by itself?
- If FCM server_key is no required to send push notification, does this means that everyone who knows user_subscription_id can send a push notification to the end user via my FCM account?
- How can I send notification with data to chrome device. Is FCM the only option? Also I would not like use google libraries on the client to get push notifications since they are really heavy.
- Ngôn ngữ chính
- Python
- Star
- 380
- Fork
- 61
- 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
- Có mẫu pull request
- Không 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 web-push-libs/pywebpush
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
web-push-libs/pywebpush#190 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
web-push-libs/pywebpush#175 · 3 bình luận ·
-
Async Send FunctionĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
web-push-libs/pywebpush#150 · 1 bình luận · 4 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
web-push-libs/pywebpush#149 · 4 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
web-push-libs/pywebpush#147 · 8 bình luận ·
Tất cả issue của web-push-libs/pywebpush
Issue tương tự
-
tests/strategies_test.py:174 goes uncovered on about 1 run in 100, failing the coverage ratchetĐang mởflaky-watch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
btclib-org/btclib#2839 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
nion-software/nionswift#2018 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Deleting a member fails when another member's share transfer points to themCó thể đã có người làm @Beerlesklopfer đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
FoodCoopX/wirgarten-tapir#1336 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
pydanty:is-working
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 71/100
pydantic/pydantic-ai#11467 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Link Checker ReportĐang mởautomated issue linkchecker report
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
QuantEcon/lecture-python.myst#1098 ·
Maintainer thường phản hồi trong vòng 1 ngày