GoogleChromeLabs / sw-toolbox

[Deprecated] A collection of service worker tools for offlining runtime requests
https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
Apache License 2.0
3.61k stars 331 forks source link

Service worker failed to Install in production #263

Closed mbj36 closed 7 years ago

mbj36 commented 7 years ago

Hello @jeffposnick

My website is hosted from gh-pages which is at https://mbj36.github.io/community-app/?baseApiUrl=https://demo.openmf.org#/ but i am unable to install service workers in production. Locally everything works fine

gh-pages branch link - https://github.com/mbj36/community-app/tree/gh-pages

I am using grunt-gh-pages to deploy. I am using this branch https://github.com/mbj36/community-app/tree/offline-reskin to deploy to gh-pages

jeffposnick commented 7 years ago

Here's what I see in the Application panel of Chrome DevTools, under the Errors for your service worker, when I visit https://mbj36.github.io/community-app/?baseApiUrl=https://demo.openmf.org#/

screen shot 2017-07-27 at 5 12 36 pm

This failure is due to the fact that the service worker needs to precache all of its dependencies in order to consider the installation successful, and the request for the (relative URL) https://mbj36.github.io/community-app/scripts/almond/almond.js dependency resulted in a 404 response. You should check to see why that expected almond.js file isn't being deployed.

mbj36 commented 7 years ago

Hey @jeffposnick I managed to register service worker in production and everything is working fine. When i open the url (https://mbj36.github.io/community-app/?baseApiUrl=https://demo.openmf.org#/) on my mobile device it also asks me to add to home screen which is also cool but when i generate lighthouse report , one of the audits says User will not be prompted to install the web app but i have cached my start_url. What could be the workaround ?

I am also not able to visit https://mbj36.github.io/community-app/?baseApiUrl=https://demo.openmf.org#/ offline

selection_052

jeffposnick commented 7 years ago

Only the version of the root URL with index.html is being cached. It sounds like you should also be caching the version of the root URL without it. This might be because you're telling sw-toolbox to cache '/' when you really should be telling it to cache './'.

mbj36 commented 7 years ago

Hi @jeffposnick Why i am getting the error on Manifest Manifest: one of 'url' or 'id' is required, related application ignored. even my manifest contains start_url

Link to Manifest - https://github.com/mbj36/community-app/blob/gh-pages/manifest.json

jeffposnick commented 7 years ago

I'm sorry, but we're outside of the realm of questions that related to sw-toolbox.

mbj36 commented 7 years ago

Thanks for the support :)