An unknown error occurred when fetching the service worker script
Reported by
john.dav...@gmail.com,
Aug 23 2016
|
|||||
Issue descriptionUserAgent: 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.
,
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.
,
Aug 23 2016
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.
,
Aug 25 2016
,
Aug 30 2016
,
Aug 31 2016
,
Aug 31 2016
I think those error messages are intended messages.
,
Aug 31 2016
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
,
Aug 31 2016
This error comes from the soft update algorithm. https://w3c.github.io/ServiceWorker/spec/service_worker/index.html#soft-update-algorithm See https://crbug.com/605817
,
Aug 31 2016
Thanks for the info! |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by john.dav...@gmail.com
, Aug 23 2016