1

I'm migrating form v3 to v4 , using workbox-window(CDN)and workbox-webpack-plugin in my vuejs app.

It works fine locally with http-server, but after deploying, I get this error and it fails to install the service worker.

print @ logger.mjs:44
(anonymous) @ logger.mjs:57
(anonymous) @ precache.mjs:23
Promise.catch (async)
installListener @ precache.mjs:20
PrecacheController.mjs:194 Uncaught (in promise) bad-precaching-response: The precaching request for 'https://dummyapp.com/_redirects?__WB_REVISION__=6a02faf7ea2a9584134ffe15779a0e44' failed with an HTTP status of 404.
    at PrecacheController._addURLToCache (https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-precaching.dev.js:445:15)
    at async Promise.all (index 0)
    at async PrecacheController.install (https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-precaching.dev.js:352:7)

How do I fix this?

Code_miss
  • 21
  • 4
  • Since you are moving across workbox releases, it might be a good idea to [cleanupOutdatedCaches](https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.precaching#.cleanupOutdatedCaches) – voiceuideveloper Aug 01 '19 at 08:04

1 Answers1

3

This happens because when a request for a precaching asset fails with a 404. In this case, the service worker installation would also fail. Check the Network tab in DevTools (ctrl+shift+i) for files that return a 404, don't precache that file. This should fix the issue.

Nasif Nuha
  • 61
  • 6