Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service worker doesn't work out of the box #22

Open
krazyjakee opened this issue Apr 18, 2021 · 3 comments
Open

Service worker doesn't work out of the box #22

krazyjakee opened this issue Apr 18, 2021 · 3 comments
Labels
question Further information is requested

Comments

@krazyjakee
Copy link

If you create an app using the template, change the serviceWorkerRegistration.unregister to serviceWorkerRegistration.register and deploy to heroku, it will give the site the SSL cert and put it in production mode (the requirements for the service worker to work). Despite this, chrome shows "No matching service worker detected".

I can't figure out where the misconfiguration is.

@jeffposnick
Copy link
Collaborator

It might be an issue due to service worker scoping; if your service worker script is being served from a subdirectory (like /scripts/sw.js) that isn't used to host your HTML pages, for instance, that could lead to a service worker that you could register but doesn't actual control your pages.

If that's not the issue, and you could provide the URL for your deployment, I'd be happy to take a look at what might the problem.

@jeffposnick jeffposnick added the question Further information is requested label Apr 21, 2021
@marcmarina
Copy link

Yeah this is still happening. I can't get it to work.

@crevulus
Copy link

crevulus commented May 3, 2022

@krazyjakee It's because by default serviceWorkerRegistration.unregister() is called. Change that to register() to work out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants