0

IM trying to signup an email auth using firebase and Expo but it says an error [2023-06-27T23:36:31.891Z] @firebase/app: Firebase: Error thrown when reading from IndexedDB. Original error: (0 , _idb.openDB) is not a function. (app/idb-get). here is code

const handleSignUp = () => {
  createUserWithEmailAndPassword(auth, email, password)
    .then((userCredential) => {
      // Signed in 
      const user = userCredential.user;
      // ...
    })
    .catch((error) => {
      const errorCode = error.code;
      const errorMessage = error.message;
      // ..
    });}

there is a redd line under auth says Argument of type '{ auth: Auth; app: FirebaseApp; }' is not assignable to parameter of type 'Auth'. Type '{ auth: Auth; app: FirebaseApp; }' is missing the following properties from type 'Auth': name, config, setPersistence, languageCode, and 10 more here is my firebase.js

import { initializeApp } from 'firebase/app';
import { getAnalytics } from "firebase/analytics";
import { getAuth } from "firebase/auth";

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
  **
};


// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const analytics = getAnalytics(app);
export default { auth ,app};

re-installing packages

1

1 Answer 1

1

You are probably making a "bad import". In firebase.js you are doing

export default { auth ,app};

and the error says

Argument of type '{ auth: Auth; app: FirebaseApp; }

So the auth you are giving to createUserWithEmailAndPassword is not an "auth object" but an object with keys "auth" and "app".

To fix the problem, I recommend you to delete the

export default { auth ,app}; line

and export things singularly:

export const auth = getAuth(app);

this way auth will be just auth.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.