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

How to use auth emulator alongside service worker? #304

Open
Demianeen opened this issue Aug 17, 2024 · 0 comments
Open

How to use auth emulator alongside service worker? #304

Demianeen opened this issue Aug 17, 2024 · 0 comments

Comments

@Demianeen
Copy link

Demianeen commented Aug 17, 2024

I was going through the Integrate Firebase with a Next.js app tutorial to connect my Next.js app with firebase. As far as I understand, it is recommended to use auth emulator for development. So, I tried to connect firebase in service worker, but apparently service worker restricted to same origin policy, so I can't connect to auth emulator that is running on 127.0.0.1:9099. Is it possible to connect auth emulator. Or is there other recommended way for local development?

Browser logs:

GET http://localhost:3000/en/sign-up 500 (Internal Server Error)
auth-service-worker.js:28 fetch for http://localhost:3000/_next/static/chunks/webpack.js
auth-service-worker.js:89 config ...
8The FetchEvent for "<URL>" resulted in a network error response: the promise was rejected.
auth-service-worker.js:28 fetch for http://localhost:3000/_next/static/chunks/main.js
auth-service-worker.js:89 config ...
auth-service-worker.js:28 fetch for http://localhost:3000/_next/static/chunks/react-refresh.js
auth-service-worker.js:89 config ...
3assert.ts:146 Uncaught (in promise) FirebaseError: Firebase: Error (auth/emulator-config-failed).
    at tn (assert.ts:146:55)
    at l (assert.ts:177:11)
    at nt (emulator.ts:50:3)
    at fc (auth-service-worker.js:94:2)
tn @ assert.ts:146
l @ assert.ts:177
nt @ emulator.ts:50
fc @ auth-service-worker.js:94
Show 3 more frames
Show less
sign-up:1 
        
        
       GET http://localhost:3000/_next/static/chunks/main.js net::ERR_FAILED
auth-service-worker.js:28 fetch for http://localhost:3000/_next/static/chunks/pages/_app.js
auth-service-worker.js:89 config {apiKey: '...', authDomain: '...', projectId: '...', appId: '...'}
auth-service-worker.js:28 fetch for http://localhost:3000/_next/static/chunks/pages/_error.js
auth-service-worker.js:89 config {apiKey: '...', authDomain: '...', projectId: '...', appId: '...'}
auth-service-worker.js:28 fetch for http://localhost:3000/_next/static/development/_buildManifest.js
auth-service-worker.js:89 config {apiKey: '...', authDomain: '...', projectId: '...', appId: '...'}
auth-service-worker.js:28 fetch for http://localhost:3000/_next/static/development/_ssgManifest.js
auth-service-worker.js:89 config {apiKey: '...', authDomain: '...', projectId: '...', appId: '...'}
sign-up:1 
        
        
       GET http://localhost:3000/_next/static/chunks/webpack.js net::ERR_FAILED
sign-up:1 
        
        
       GET http://localhost:3000/_next/static/chunks/react-refresh.js net::ERR_FAILED
4assert.ts:146 Uncaught (in promise) FirebaseError: Firebase: Error (auth/emulator-config-failed).
    at tn (assert.ts:146:55)
    at l (assert.ts:177:11)
    at nt (emulator.ts:50:3)
    at fc (auth-service-worker.js:94:2)
tn @ assert.ts:146
l @ assert.ts:177
nt @ emulator.ts:50
fc @ auth-service-worker.js:94
Show 3 more frames
Show less
sign-up:1 
        
        
       GET http://localhost:3000/_next/static/development/_buildManifest.js net::ERR_FAILED
sign-up:1 
        
        
       GET http://localhost:3000/_next/static/chunks/pages/_app.js net::ERR_FAILED
sign-up:1 
        
        
       GET http://localhost:3000/_next/static/chunks/pages/_error.js net::ERR_FAILED
sign-up:1 
        
        
       GET http://localhost:3000/_next/static/development/_ssgManifest.js net::ERR_FAILED
auth-service-worker.js:28 fetch for chrome-extension://aeblfdkhhhdcdjpifhhbdiojplfjncoa/inline/injected.js
auth-service-worker.js:28 fetch for http://localhost:3000/favicon.ico
auth-service-worker.js:89 config {apiKey: '...', authDomain: '...', projectId: '...', appId: '...'}
assert.ts:146 Uncaught (in promise) FirebaseError: Firebase: Error (auth/emulator-config-failed).
    at tn (assert.ts:146:55)
    at l (assert.ts:177:11)
    at nt (emulator.ts:50:3)
    at fc (auth-service-worker.js:94:2)
tn @ assert.ts:146
l @ assert.ts:177
nt @ emulator.ts:50
fc @ auth-service-worker.js:94
Show 3 more frames
Show less
:3000/favicon.ico:1 
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

1 participant