New issue
Advanced search Search tips

Issue 640053 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner:
Closed: Aug 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

An unknown error occurred when fetching the service worker script

Reported by john.dav...@gmail.com, Aug 23 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

Steps to reproduce the problem:
1. Follow the setup https://github.com/lodash/lodash.github.io#running-locally and start `jekyll serve`.

2. On loading the page notice an error in the console:

"Fetch API cannot load https://embed.tonicdev.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:4000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled." 

despite being caught in the promise `.catch`.
(source https://github.com/lodash/lodash.github.io/blob/master/sw.js)

3. Disconnect from the network and end the `jekyll serve` process.

4. Reload the page and see:

An unknown error occurred when fetching the script (sw.js)
GET http://127.0.0.1:4000/sw.js net::ERR_CONNECTION_REFUSED

What is the expected behavior?
Expected behavior is that the error of step 3 and step 4 are not shown.

If you repeat the steps using https://lodash.github.io/ instead of running locally then only the error from step 3 appears. Neither error appear in Firefox.

What went wrong?
It logged an error in step 3 and 4.

Did this work before? N/A 

Chrome version: 52.0.2743.116  Channel: stable
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 22.0 r0

I tried this in Canary  54.0.2836.0 (64-bit) and Chromium Version 54.0.2837.0 (64-bit) with similar results.
 
step-3-local.png
138 KB View Download
step-4-local.png
114 KB View Download
step-3-gh-pages.png
140 KB View Download
step-4-gh-pages.png
99 KB View Download
I should note that the errors don't appear to prevent the cache from working.

Comment 2 by bke...@mozilla.com, Aug 23 2016

Note, I think firefox would like to log an error in step (2) when the CORS request fails.  Its probably a bug that we don't.  CORS is so poorly understood (by everyone) that we try to log extra information when a CORS request fails.  In this case we don't log anything because the service worker is not directly associated with a window context.

The error in step (4) is most likely triggered when chrome attempts to update the service worker script in the background after the navigation.  We do the same thing, but we don't log an error if the script is unreachable.
More info:

Both errors of step 3 and 4 happens with and without the console setting "Disable cache (while DevTools is open)" is enabled.

Step 4 happens with and without the service worker "Update on reload" application tab setting enabled. With "Update on reload" enabled the error just flashes in the console quickly before being cleared.
Labels: TE-NeedsTriageHelp
Owner: horo@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 6 by horo@chromium.org, Aug 31 2016

Components: Blink>ServiceWorker

Comment 7 by horo@chromium.org, Aug 31 2016

Status: WontFix (was: Assigned)
I think those error messages are intended messages.

Can you explain the error:

An unknown error occurred when fetching the script (sw.js)
GET http://127.0.0.1:4000/sw.js net::ERR_CONNECTION_REFUSED
Thanks for the info!

Sign in to add a comment