Issue metadata
Sign in to add a comment
|
registration.pushManager.subscribe() fails when called by service worker |
||||||||||||||||||||||||
Issue descriptionVersion: 49.0.2623.87 (64-bit) / 51.0.2688.0 canary (64-bit) OS: OS X registration.pushManager.subscribe() fails with DOMException: Registration failed - gcm_sender_id not found in manifest even though the manifest exists. See https://rawgit.com/ithinkihaveacat/9ca2fc0f152f55b042da/raw/1b96406452250bf5ab2fd7915377207ba387e714/index.html (Calling foo() in the service worker causes the error.) Note that if a subscription already existed, and the service worker does an unsubscribe() followed by a subscribe(), then the subscription succeeds: https://rawgit.com/ithinkihaveacat/9ca2fc0f152f55b042da/raw/7bace6be30764150a5a35e873840626378ced272/index.html (So basically the bug is more that subscribe() fails the "first" time--subsequent subscribe() calls succeed.) What is the expected output? subscribe() always succeeds. (If manifest provided.) What do you see instead? subscribe() fails if the client has never subscribed (via the controlled page) before. Please use labels and text to provide additional information.
,
Mar 23 2016
A Service Worker does not have a manifest unfortunately. Did you subscribe from the client first, followed by a second subscription from the Service Worker? That should work. We're adding a way to supply the application server's public key (or.. the sender Id) from the API instead: crbug.com/583753
,
Mar 24 2016
Can Jen make the change as part of crbug.com/583753 ?
,
Mar 24 2016
Yes, this is the error I discovered earlier this week that I've been working to fix.
,
Mar 24 2016
Yes, subscribing from the client, then unsubscribing (in SW), and then re-subscribing (in SW) works so removing the need for a manifest via crbug.com/583753 will fix it, thanks! (Re the manifest, I was expecting the service worker to acquire a manifest via its "claim" on the page. The fact that the subscribe/unsubscribe state changes puts the browser into a state where the subscribe actually works was also unexpected.)
,
Mar 24 2016
Cool. Let's duplicate against that bug then :-) Service Workers can run without having an active page at all. When there are pages, there are a bunch of situations in which it's tricky to do the right thing: only some pages have a manifest, multiple pages have different manifests, a cached manifest may have to be updated, and so on. The subscribe/unsubscribe trick really is a hack to make this work in the current situation, but it's not sufficient for the long run. That's exactly what Jen is fixing. |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by stillers@google.com
, Mar 23 2016