PWA Error: Failed to register a ServiceWorker

  • I am having some issues upgrading my PWA app from .15 to .16

    I got a little frustrated thinking it may be something with my app itself, so I created a brand new PWA app from the new CLI and still have issues with the service worker path.

    The app works fine, but the service worker never gets registered/updated

    Basically here is my error,

    Error during service worker registration: TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.

    my app is upload to a subdirectory on my domain, so the service worker is located there.


    but the fresh PWA is trying to register a service worker located at the root & not the subdirectory

    is this a bug? or am I missing a configuration option for the new PWA/workbox?

    before I was using the build -> publicPath to control where all the files should be, but it seems like publicPath should be empty now.

  • Admin


    Don’t use subdirectories to deploy your PWA, even if you set your publicPath correctly.

  • This post is deleted!

  • @rstoenescu What if I have a bunch of other things on the server? Including other PWAs? The PWA app needs a place of its own so it can play nice with others.

    create a separate sub-domain?
    different names for the various service workers?

    This did work in .15

  • Admin

    I would recommend using sub-domains.

  • @rstoenescu I just ran in the same issue. Due to the domain being outside of my control, I can’t easily create subdomains. I use a reverse proxy with subdomains which works great with the4 SPA, but now I want to experiment with a PWA (hosted from a subdirectory). Is this something fundamentally impossible or just not implemented in the quasar template? According to @daveline this was possible in 0.15, what would it take to re-enable this functionality?

Log in to reply