I am developing a React Native application using Expo and Firebase. I’m trying to use the createUserWithEmailAndPassword function to create a new user with email and password authentication. However, I’m encountering the following error:
TypeError: undefined is not a function, js engine: Hermes
This error seems to be related to the createUserWithEmailAndPassword function. I have been searching through the Expo and Firebase documentation, but I haven’t found a suitable solution yet. Here is the code I am using:
firebase.js:
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
const firebaseConfig = {
apiKey:,
authDomain: ,
projectId: ,
storageBucket: ,
messagingSenderId: ,
appId: ,
measurementId:,
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
export default { auth };
SignUp.js:
import auth from "../firebase/firebase";
function createUser() {
auth.createUserWithEmailAndPassword(email, password).then(() => {
console.log("worked");
});
}
Is there a compatibility issue between the Hermes JavaScript engine and the Firebase Web SDK? Or is there any other solution to this issue?
Any help would be appreciated!
2
Answers
In my firebase.js file, I changed the export statement to use named exports for the app and auth objects:
By using named exports and correctly importing the auth object, I was able to resolve the "TypeError: of undefined" error and successfully create a new user using Firebase authentication.
this is its type