Skip to content

Uncaught FirebaseError: Firebase: Error (auth/internal-error) when Firestore is initialized before Auth #4290

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

Closed
mbleigh opened this issue Jan 14, 2021 · 2 comments

Comments

@mbleigh
Copy link

mbleigh commented Jan 14, 2021

If I do this code:

import { initializeApp } from 'firebase/app';
import { getFirestore } from 'firebase/firestore';
import { getAuth } from 'firebase/auth';

export const app = initializeApp({});

export const db = getFirestore(app);
export const auth = getAuth(app);

on version 0.900.4 I get:

Uncaught FirebaseError: Firebase: Error (auth/internal-error).
    at createErrorInternal (http://localhost:8080/_snowpack/pkg/firebase/auth.js:250:55)
    at _assert (http://localhost:8080/_snowpack/pkg/firebase/auth.js:260:35)
    at AuthImpl.registerStateListener (http://localhost:8080/_snowpack/pkg/firebase/auth.js:3886:9)
    at AuthImpl.onIdTokenChanged (http://localhost:8080/_snowpack/pkg/firebase/auth.js:3745:21)
    at AuthInternal.addAuthTokenListener (http://localhost:8080/_snowpack/pkg/firebase/auth.js:6089:37)
    at new F$1 (http://localhost:8080/_snowpack/pkg/firebase/firestore.js:2014:35)
    at new Mc$1 (http://localhost:8080/_snowpack/pkg/firebase/firestore.js:15478:20)
    at new Bu (http://localhost:8080/_snowpack/pkg/firebase/firestore.js:17007:9)
    at http://localhost:8080/_snowpack/pkg/firebase/firestore.js:18692:72
    at Component.instanceFactory (http://localhost:8080/_snowpack/pkg/firebase/firestore.js:18692:85)

if I instead change the order so getAuth() occurs before getFirestore(), it seems to work properly.

@mbleigh mbleigh added the alpha label Jan 14, 2021
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@hsubox76
Copy link
Contributor

hsubox76 commented Feb 9, 2021

I think this was addressed by #4428

@hsubox76 hsubox76 closed this as completed Feb 9, 2021
@firebase firebase locked and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants