Thursday, 17 January 2019

workbox serviceworker working everywhere except Chrome: Uncaught (in promise) DOMException

Workbox is not working on Chrome, but it works everywhere else, which is ironic since I believe this is a Google library, the error that shows is :

Uncaught (in promise) DOMException : sw.js line 1

Chrome:

enter image description here

Opera enter image description here

Firefox enter image description here

I'm using the workbox-webpack-plugin

webpack.config.js

    const workbox = require('workbox-webpack-plugin'); 

    module.exports = {
        plugins: [
            new workbox.GenerateSW({
                swDest: './service-worker.js',
                skipWaiting: true,
                clientsClaim: true
            })
        ]  
 }

index.ts (entry)

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('/js/app/dist/service-worker.js');
  }); 
}

EDIT: This is the line of code that throws the error

enter image description here

enter image description here

EDIT 2: it actually works on icognito mode, removing browser data still doesn't help.

enter image description here

EDIT 3: Updating to the newest beta 1, is even worse, since aside from the last errors it will show another one, however, this version works in Chrome's icognito mode and other browsers too.

enter image description here



from workbox serviceworker working everywhere except Chrome: Uncaught (in promise) DOMException

No comments:

Post a Comment