New issue
Advanced search Search tips

Issue 848645 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug-Regression



Sign in to add a comment

ServiceWorker cannot be started

Reported by chem...@gmail.com, Jun 1 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36

Steps to reproduce the problem:
I'm seeing an error in the latest version of Chrome (67) where ServiceWorkers fail to start for several of my projects. These same SW have been working just fine up until recently (I'm not 100% sure but I think Chrome 67 introduced it).

Note: I've quickly tested this on MacOS, Chrome 67. I haven't been able to reproduce the problem there. I also tested in on multiple Windows 10 machines and *was* able to reproduce it on those.

I'm getting this error:
Uncaught (in promise) DOMException: Failed to update a ServiceWorker: ServiceWorker cannot be started

I also see this error in the console:
Failed to load resource: net::ERR_BLOCKED_BY_CLIENT

Dev Tools' Network tab shows status "failed" for sw.js

What is the expected behavior?
a) A SW that worked fine in v66 should work fine in v67
b) Debugging this (and SW-issues in general) is a nightmare. There is absolutely no hint/clue as to what is causing this.

What went wrong?
SW's that worked fine now suddenly don't work anymore.

Did this work before? Yes 66.x

Chrome version: 67.0.3396.62  Channel: stable
OS Version: 10.0
Flash Version: 

I've attached three similar SW files, all of them fail to start. 

I can provide links to the live projects but would rather not share them publicly.
 
sw.js
21.7 KB View Download
Cc: pbomm...@chromium.org
Labels: Needs-Triage-M67

Comment 2 by chem...@gmail.com, Jun 1 2018

I've even tried a very minimal version of a sw and it gives me the same(-ish) errors:

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
SW registration failed with error AbortError: Failed to register a ServiceWorker: ServiceWorker cannot be started

I would like to attach it but I'm getting an error (rly? :P) when I click the Attach a file button below the comment box (see below) so I've uploaded it somewhere else:
https://stor4ge.rejh.nl/_stored/dump/temp/sw-simple-chromium-issue-848645.js

Uncaught TypeError: _fetchOptions is not a function
    at Array.<anonymous> (detail?id=848645&can=2&q=serviceworker fails to start&colspec=ID Pri M Stars ReleaseBlock Component Status Owner Summary OS Modified:1181)
    at window.onload (detail?id=848645&can=2&q=serviceworker fails to start&colspec=ID Pri M Stars ReleaseBlock Component Status Owner Summary OS Modified:74)
2detail?id=848645&can=2&q=serviceworker fails to start&colspec=ID Pri M Stars ReleaseBlock Component Status Owner Summary OS Modified:1020 Uncaught TypeError: _addAttachmentFields is not a function
    at HTMLAnchorElement.<anonymous> (detail?id=848645&can=2&q=serviceworker fails to start&colspec=ID Pri M Stars ReleaseBlock Component Status Owner Summary OS Modified:1020)

Comment 3 by tkent@chromium.org, Jun 1 2018

Components: -Blink Blink>ServiceWorker

Comment 4 by chem...@gmail.com, Jun 1 2018

Just checked mobile.twitter.com to verify if I can reproduce this there. The answer is yes:

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
main.1dbc955161d4e61c.js:1 error-reporting: AbortError: Failed to register a ServiceWorker: ServiceWorker cannot be started {index: "responsive_web_prod", type: "ERROR", id: 1527859666223, source: {…}, tag: "DOMException"}

Comment 5 by chem...@gmail.com, Jun 1 2018

I got a different error in Chrome Beta, I guess it's related?

The FetchEvent for "https://DOMAIN/?gotoSection=onboard&gotoScreen=0" resulted in a network error response: the promise was rejected.

And then

Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode

Which is weird because the request that failed (first line) *is* on the same origin?
Cc: falken@chromium.org

Comment 7 by creis@chromium.org, Jun 1 2018

Cc: creis@chromium.org
I suspect this is not the cause, but can you try disabling Site Isolation just to confirm the problem still happens?  You can do this at chrome://flags#site-isolation-trial-opt-out, choosing "Opt-out (not recommended)," and restarting.

More info at:
https://www.chromium.org/Home/chromium-security/site-isolation#TOC-Diagnosing-Issues

(I'm guessing this is more related to actual ServiceWorker code than Site Isolation, but it doesn't hurt to rule it out.)

Comment 8 by chem...@gmail.com, Jun 2 2018

That doesn't work, unfortunately. On my first load I get:

Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode

And when I reload:

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
Uncaught (in promise) DOMException: Failed to update a ServiceWorker: ServiceWorker cannot be started
Cc: yhirano@chromium.org
Status: WontFix (was: Unconfirmed)
The attachments in comment 0 are not complete so I can't test them (they don't include the importScripts contents).

The attachment in comment 2 works fine for me (if _log is defined to console.log) at https://crbug848645.glitch.me/. I suspect ERR_BLOCKED_BY_CLIENT has something to do with your environment. Based on other bugs, this error seems to have to do with extensions.

The error in comment 5 and 8 indicates an error in the service worker JavaScript code at a call to fetch(). This error message was added in Chrome 64. It says that Request.cache is 'only-if-cached' and Request.mode is 'same-origin', which is not a valid combination.  See:
https://developer.mozilla.org/en-US/docs/Web/API/Request/cache
https://developer.mozilla.org/en-US/docs/Web/API/Request/mode

To fix this error, change the cache property or the mode property to something else.

I'm not sure why this might have regressed, as there is no script to test on. Setting to WontFix but let me know if you can create a closed script that worked in an earlier Chrome and doesn't work with current Chrome.

Comment 10 by chem...@gmail.com, Jun 4 2018

> The attachment in comment 2 works fine for me (if _log is defined to console.log) at https://crbug848645.glitch.me/. I suspect ERR_BLOCKED_BY_CLIENT has something to do with your environment. Based on other bugs, this error seems to have to do with extensions.

Looks like it was one of the uBlock Origin filters that blocked the import of the firebase library. /facepalm

Right, I guess I'll try to contact the maintainer of that filter list and let him know about the issue. Thanks!

Sign in to add a comment