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

Getting offline functionalties to work in DevMode #137

Closed
Erik-Sovereign opened this issue May 8, 2019 · 8 comments
Closed

Getting offline functionalties to work in DevMode #137

Erik-Sovereign opened this issue May 8, 2019 · 8 comments

Comments

@Erik-Sovereign
Copy link

Erik-Sovereign commented May 8, 2019

Hello everyone,
I was trying out the example in next-offline/examples/now2/. I "yarn install" 'd it and deployed it with now. Offline functionalities worked just great!
It didn't work in dev mode though (yarn dev). The only change I made to the files, was adding "generateInDevMode" in next.config.js
Like this:
const nextConfig = { generateInDevMode: true, workboxOpts: { ...
The error thrown on localhost is:
SW registration failed: TypeError: "ServiceWorker script at http://localhost:3000/service-worker.js for scope http://localhost:3000/ encountered an error during installation."

I have the same problem in the project I'm working on. The service worker is registered when hosted with now but not in dev mode. I hope we can fix the issue for everyone in the example so that I can fix it in my project afterwards.

My question is what addtional steps do I have to take to get this to work in dev mode?
Another question is if the offline functionalities or more specific next-offline are generally expected to work in Dev Mode?

Thank you!

@hanford
Copy link
Owner

hanford commented May 9, 2019

are you using now dev ?

We haven't really spent much time making the plugin work in development other than ensuring the SW registers and stuff correctly.

@Erik-Sovereign
Copy link
Author

Thanks for your time!
I tried it after you suggested it. Unfortutanely now dev isn't working for me. While looking at the issues of now-cli I think it is a Windows 10 issue.

Do you know an alternative way than yarn dev or now dev to test Service Workers faster than with deploying the site with them every time?

@hanford
Copy link
Owner

hanford commented May 9, 2019

@Erik-Sovereign now dev isn't actually working for me either over on my personal website. I'm about to take off on vacation for the next few days, but if I have some downtime I'll take a look

@Erik-Sovereign
Copy link
Author

Thank you very much. I appreciate it.

@mrspeaker
Copy link

mrspeaker commented May 14, 2019

[UPDATE: this appears to be an issue on on Firefox on Linux]

I am having the same issue - but it seems like it's in prod mode too? If I do a clean clone of the test example and build and npm start, it throws the same errors:

Screenshot from 2019-05-14 17-14-04

This is in Firefox, on Ubuntu.

[EDIT: I just tested https://jackhanford.com/ and I am seeing the same errors there too]

@hanford
Copy link
Owner

hanford commented May 14, 2019

@mrspeaker I'm not seeing those errors on my website in any browser (don't have access to Ubuntu) ..

Can you share a screenshot of this happening on my website?

Screen Shot 2019-05-14 at 2 41 36 PM

@mrspeaker
Copy link

mrspeaker commented May 15, 2019

@hanford - hmm, ok - it must be something in my Firefox then. I have my mac with me today and I'll see if I can figure out what it is. Here's what I get on your page (the warning is because I am blocking Segment.io, but I have white-listed everything else)

Screenshot from 2019-05-14 17-58-57

[Update: Sorry, this appears to be a Firefox/Linux issue: I'll log a bugzilla bug]

@hanford
Copy link
Owner

hanford commented Jul 10, 2019

hey friends, going to close this in favor of #155

I'd like to prioritize this and if I have some downtime this seems like the biggest issue people have.

@hanford hanford closed this as completed Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants