auth-service-worker.js not found
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.
I inspected the network call and could see the request for auth-service-worker.js returned 404.
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
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.
did anyone find the solution to this?
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.