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

auth-service-worker.js not found #299

Open
minhdanh opened this issue Jun 7, 2024 · 4 comments · May be fixed by #307
Open

auth-service-worker.js not found #299

minhdanh opened this issue Jun 7, 2024 · 4 comments · May be fixed by #307

Comments

@minhdanh
Copy link

minhdanh commented Jun 7, 2024

I'm seeing this error when running nextjs-end:

Unhandled Runtime Error
TypeError: Failed to register a ServiceWorker for scope ('http://localhost:3000/') with script ('http://localhost:3000/auth-service-worker.js?firebaseConfig=[filtered]'): A bad HTTP response code (404) was received when fetching the script.
image

I inspected the network call and could see the request for auth-service-worker.js returned 404.

@minhdanh
Copy link
Author

minhdanh commented Jun 7, 2024

If I move the file auth-service-worker.js to /public and refresh, then I see another error:

TypeError: Failed to register a ServiceWorker for scope ('http://localhost:3000/') with script ('http://localhost:3000/auth-service-worker.js?firebaseConfig=[filtered]'): ServiceWorker script evaluation failed

@rlw87
Copy link

rlw87 commented Jun 8, 2024

If you look in the package.json you'll see there's an extra build-service-worker task in the scripts block. This is called by the build task and is what packages auth-service-worker.js up and makes it available in the public folder. You'll need to npm install esbuild for this to work.

@t77bsh
Copy link

t77bsh commented Jun 28, 2024

did anyone find the solution to this?

@heckchuckman
Copy link

As @rlw87 mentioned, you have to run the build-service-worker script and then it appears to work.

npm run build-service-worker

Hope that helps.

@jamesdaniels jamesdaniels linked a pull request Sep 11, 2024 that will close this issue
5 tasks
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

Successfully merging a pull request may close this issue.

4 participants