Comments (20)
Everything was working fine up until adding the event listener to sw.js. I've added the code but the push button in dev tools does not send a push. The event isn't triggered at all whatsoever. Doesn't matter if I unregister and restart the site. Why wouldn't the event listener be working?
from web-push-codelab.
@Abraham21 On my personal computer I was able to send a push from a push service but not the "Push" button in dev tools. So the event listener seems to be working but the "Push" button in dev tools seems to not be working.
from web-push-codelab.
@varora1406, the push event listener needs to go in sw.js, not main.js. It got me too.
It makes sense because self
refers to the service worker itself.
from web-push-codelab.
If you look at the pictures from the docs https://developers.google.com/web/ilt/pwa/tools-for-pwa-developers#update they are different to what the latest chrome interface is maybe this worked on older chrome?
from web-push-codelab.
Wasted about 3 hours to find out Chrome is broke. Download Chrome Dev. Latest version has the button fixed. Can run it along side your normal Chrome, so no need to uninstall anything...
from web-push-codelab.
@TheCreeperCow Nope, unfortunately not. It seems like the push button in dev tools doesn't work for anyone here. Or if it does then it's not working for this type of project. Though the code is an event listener so it seems as if dev tools isn't emiting the proper event or an event at all. Idk I'm just guessing.
from web-push-codelab.
Had the same issue, used chrome canary to fix this
from web-push-codelab.
@varora1406 could you please explain a little more about what you mean by "when I launched a push from application tab in chrome"
from web-push-codelab.
Ah got you. @colepacak @varora1406 could you suggest any ways to improve the code to make this more obvious?
from web-push-codelab.
@gauntface, after looking back at the docs, you're pretty clear on the fact that the service worker code belongs in sw.js
, but I blew right past it as I was going through the tutorial.
One thing that may help is to add one of those slick blue callouts with the blue star (with the "note" CSS class) right after the initial service worker code reminding users that sw.js
is the home for all of the service worker event listeners.
Thanks for the great docs.
from web-push-codelab.
@DanJ210 did you solve this? I have the same problem right now.
from web-push-codelab.
@DanJ210 Did you find a fix at my end the push button in the chrome devtools also seems to be not functioning when i try to send a push message using a site it works but not when i try it using chrome devtools
from web-push-codelab.
@noobling it's very possible. We are using Google's own training so you'd think there'd be some heads up to Google people if a major tool is changing. Have you worked through this course?
from web-push-codelab.
I just run into the same issue. It looks like a bug in DevTools.
849241 - Service worker's Push/Sync locally triggered events don't work - chromium - Monorail
https://bugs.chromium.org/p/chromium/issues/detail?id=849241
from web-push-codelab.
Getting the exact same behavior. I can not use the Push button to test my service worker.
All other events fire no problem (Install, Activate) but push doesn't even fire at all using the "Push" test button.
from web-push-codelab.
Check your chrome version now. Version 71.0.3578.80would be work correctly.
Previous version(70.0.3538.110?) of chrome didn't work in my case.
from web-push-codelab.
Works great on version 71.0.3578.80
from web-push-codelab.
Similar issue, here. Sometimes notifications do not show on some systems. My Chrome is 78.0.3904.70 so is my product manager's, but he cannot get the notifications to show up. I can see the service-worker receive the payload and everything.
from web-push-codelab.
For anyone else struggling with the issue: make sure your push listener is in the service worker itself.
from web-push-codelab.
If you are sure your service worker is registered in the browser but your 'push' event is not getting triggered, you can debug all incoming push notifications to Google Chrome by doing the following:
- Open
chrome://gcm-internals
- Start recording
- Send a test push notification to the browser
- Observe the logs
The server was getting a 201 on the push request and the browser threw no errors in the console log. However, I was having a decryption issue. The browser was receiving the push notification but failed to decrypt it: AES-GCM decryption failed
.
Helpful Source: https://developers.google.com/web/fundamentals/push-notifications/common-issues-and-reporting-bugs
from web-push-codelab.
Related Issues (20)
- Unsubscribe Event does not remove subscription from browser settings
- Code worked but no pop up for notifications HOT 2
- the key in the authorization header does not correspond to the sender ID used to subscribe this user HOT 1
- How does it work?
- Doesn't redirect to new tab when click on Allow in notification
- web-push-codelab.glitch.me is down
- Bug: missing step in tutorial, in notification click
- Latency in google web push GCM responses after january 2019
- MissmatchSenderId HOT 1
- Send Push Message Error
- 403 - forbidden HOT 1
- push notifications are not working HOT 2
- The text is only shown in the console
- Web Notification & bug HOT 1
- Failed to execute 'atob' on 'Window' HOT 3
- Error in description
- Not working in Microsoft Edge HOT 1
- Does not load the page https://web-push-codelab.glitch.me/ HOT 7
- it helped me to show notification on web. thankyou so much for that but it isn't showing notification on mobile. what i have to do. Waiting for the solution with hope.
- Cannot read property 'pushManager' of null HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-push-codelab.