Search code examples
javascriptvue.jspromiseservice-workerdomexception

Plenty of Uncaught (in promise) DOMException errors in simple Vue.js app


I'm developing simple Vue.js application as a learning project using Vue.js, Quasar and Vuex. For some unknown (to me) reason I'm getting lots of Uncaught (in promise) DOMException errors. The application works just fine, but those red errors don't seem right. How can I debug and fix these?

While refreshing website, errors show up in console right away. I think it's even before app itself is fully loaded:

Console screenshot

Each error takes form of:

Uncaught (in promise) DOMException    service-worker.js:1

Promise.then (async)
(anonymous)         @ workbox-strategies.dev.js:681
step                @ workbox-core.dev.js:14
(anonymous)         @ workbox-core.dev.js:25
Promise.then (async)
step                @ workbox-core.dev.js:24
(anonymous)         @ workbox-core.dev.js:32
(anonymous)         @ workbox-core.dev.js:11
_getNetworkPromise  @ workbox-strategies.dev.js:691
(anonymous)         @ workbox-strategies.dev.js:554
step                @ workbox-core.dev.js:14
(anonymous)         @ workbox-core.dev.js:32
(anonymous)         @ workbox-core.dev.js:11
makeRequest         @ workbox-strategies.dev.js:578
(anonymous)         @ workbox-strategies.dev.js:504
step                @ workbox-core.dev.js:14
(anonymous)         @ workbox-core.dev.js:32
(anonymous)         @ workbox-core.dev.js:11
handle              @ workbox-strategies.dev.js:508
handleRequest       @ workbox-routing.dev.js:365
(anonymous)         @ workbox-routing.dev.js:835

Clearing cache and hard reloading site doesn't work.

I am starting the app via npm run dev script.

Whole code is available on BitBucket repository


Solution

  • As Ohgodwhy suggested, the source of the problem was some old service worker installed on my domain (in this case simply localhost). The idea is to remove it.

    To remove service worker in Chrome browser:

    1. Open developer tools in your browser (F12 or command + option + i)
    2. Head to Application tab
    3. Go to Service Workers section
    4. Click Unregister on service worker that could be broken