firebase / friendlyeats-web

Apache License 2.0
437 stars 393 forks source link

auth-service-worker.js not found #299

Open minhdanh opened 3 weeks ago

minhdanh commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 1 day ago

did anyone find the solution to this?