Skip to content Skip to sidebar Skip to footer

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) DOMExce

Solution 1:

This error is usually thrown if the browser is out of allocated disk space quota. Your incognito is working because it will be allocated with new disk quota, where as normal tabs share same disk quota.

Can you open Application tab in devtools and click on Clear storage > Clear site data? This should fix this issue in most of the cases.

Disk Quota

Solution 2:

Chrome autoupdated to version 72 and now it works for me and my colleagues. Its most probably a fixed bug.

Solution 3:

You might have the scope of your SW file wrong. Try this:

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

If you can not move the SW file you need to add a special header to your backend:

Server {

    listen www.example.com:443 ssl;

    ...

    location /js/app/dist/service-worker.js {
        add_header 'Service-Worker-Allowed''/';
    }
}

(nginx configuration)

Post a Comment for "Workbox Serviceworker Working Everywhere Except Chrome: Uncaught (in Promise) Domexception"