Unable to send notification to chrome with data.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 18/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- firebase, javascript, python
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 380
- Fork
- 61
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di web-push-libs/pywebpush
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
web-push-libs/pywebpush#190 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
web-push-libs/pywebpush#175 · 3 commenti ·
-
Async Send FunctionAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
web-push-libs/pywebpush#150 · 1 commento · 4 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
web-push-libs/pywebpush#149 · 4 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
web-push-libs/pywebpush#147 · 8 commenti ·
Tutte le issue di web-push-libs/pywebpush
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
pydot/pydot#601 · 4 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
letsencrypt/cp-cps#361 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
CI: startup_failure because callers grant fewer permissions than ledger-app-workflows@v1 declaresForse già presa @maykonmichel l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
LedgerHQ/app-boilerplate-rust#227 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
linuxmint/mintupdate#1107 ·