PWA service worker is not caching index.html

  • Hello everyone,
    According to PWA documentation we should expect:

    Lighthouse score of 90+/100

    I was wondering what is the reason, and what can be done to fix it.
    Apart from that, I am getting an error on Lighthouse that says that my main index file is not being cached by a service worker. This is not true because opening the network tab I can see that the main page is being served from the service worker and the app works fine offline. However, the problem may by that my main page is not called index.html, but instead it has the name of my subpath (it’s being served from within my domain).

    This is the exact error

    Failures: Manifest start_url is not cached by a Service Worker.

    And here it is my manifest file

      "name": "JSON tools",
      "short_name": "JSONTools",
      "icons": [{
          "src": "/statics/icons/icon-192x192.png",
          "sizes": "192x192",
          "type": "image/png"
          "src": "/statics/icons/icon-512x512.png",
          "sizes": "512x512",
          "type": "image/png"
      "start_url": "JSONTools",
      "display": "standalone",
      "background_color": "#ffffff",
      "theme_color": "#027be3"

    As you can see, I tried to change the start_url to match my subdomain name, but that does not work either.

    I want to fill that gap. It’s not important for my current project, but it will be for many projects I plan to build with Quasar.
    My page (if someone wants to test) is

    Thanks in advance.

  • Admin

    Seems like an awesome tool you’re building there. Please open up a github ticket on PWA template repo and I’ll investigate. Thanks for reporting.

    PS: The PWA score from my tests is 99/100

  • Admin

    Not getting any error on the link you indicated… Am I missing something? Provide as many details as possible pls. Thanks.

  • Admin

    Oh, I see now. In your case, just add start_url property to the manifest file (/src/statics/manifest.json), pointing it to Cannot do that from the starter kit as the URL varies according to where it’s going to get deployed.

  • Hello @rstoenescu
    Thanks for your prompt response and your kind words!
    I expected the start_url on the manifest to be a bit less specific. I mean, I expected to be able to just specify a relative path. I understand that this is how browsers (or lighthouse) works and that you can’t know it beforehand. However, a small note on the PWA starter kit documentation will help newcomers.

    I tried adding the full url as you suggested to the manifest and then the service_worker does not work at all. Is there anything else should I do ?

    If you like the tool, feel free to link it whenever you want 😄

  • Ok, there should be something weird with the cache after the build process. I manually updated the manifest file directly on the gh_pages branch to point to and now I get 100 of 100 on the PWA check and the service worker works fine.

    I’ll try again to set it on the master branch and let it build to see if it happens again.

    Many thanks!!!

Log in to reply