No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    PWA Error: Failed to register a ServiceWorker

    Help
    3
    6
    3298
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      daveline last edited by

      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.

      https//mydomain.com/myapp/service-worker.js

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

      https://mydomain.com/service-worker.js

      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.

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        Hi,

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

        1 Reply Last reply Reply Quote 0
        • D
          daveline last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • D
            daveline last edited by

            @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?
            other?

            This did work in .15

            1 Reply Last reply Reply Quote 0
            • rstoenescu
              rstoenescu Admin last edited by

              I would recommend using sub-domains.

              1 Reply Last reply Reply Quote -1
              • T
                tdamsma last edited by

                @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?

                1 Reply Last reply Reply Quote 2
                • First post
                  Last post