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?
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.
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.