Serviceworker: What's the possible reason for navigator.serviceWorker.register error?

Created on 2 Feb 2018  ·  2Comments  ·  Source: w3c/ServiceWorker

I register service worker like this:

navigator.serviceWorker.register('/sw.js', {
    scope: '/'
}).then(function(registration) {}).catch(function(err) {console.log(err)})

In production environment, I caught some errors like The request to fetch the script was interrupted.and The Service Worker system has shutdown. What's the possible reasons for above errors?

Most helpful comment

These are Chrome-specific error messages. The "interrupted request" means for whatever reason the network request that tried to download the service worker script was aborted/killed by Chrome, and we have no more info to make a better error message. The "shutdown" message is cryptic but it means for whatever reason the service worker infrastructure is gone.. it could mean the browser or this profile are shutting down. I think we might also emit this if a disk error/corruption happens and we have to throw away all service worker state on disk and start over.

All 2 comments

These are Chrome-specific error messages. The "interrupted request" means for whatever reason the network request that tried to download the service worker script was aborted/killed by Chrome, and we have no more info to make a better error message. The "shutdown" message is cryptic but it means for whatever reason the service worker infrastructure is gone.. it could mean the browser or this profile are shutting down. I think we might also emit this if a disk error/corruption happens and we have to throw away all service worker state on disk and start over.

@mattto Thanks for your answer.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lewispham picture lewispham  ·  12Comments

mfalken picture mfalken  ·  10Comments

lewispham picture lewispham  ·  4Comments

chebaby picture chebaby  ·  9Comments

jakearchibald picture jakearchibald  ·  5Comments