GitHub issue link https://github.com/firebase/firebase-js-sdk/issues/5840
Operating System version: MacOS Monterey 12.1 Browser version: Chrome Version 96.0.4664.110 (Official Build) (x86_64) Firebase SDK version: 9.6.1 Firebase Product: Authentication_
When trying to Login user by firebase signInWithEmailAndPassword method, the below error is occurring.
backend/node_modules/@firebase/auth/dist/node/index-fe696f9c.js:506
return (_a = authOrCode._errorFactory).create.apply(_a, tslib.__spreadArray([code], fullParams));
^
TypeError: Cannot read properties of undefined (reading 'create')
at createErrorInternal (/node_modules/@firebase/auth/dist/node/index-fe696f9c.js:506:48)
at _createError (node_modules/@firebase/auth/dist/node/index-fe696f9c.js:484:32)
at Timeout._onTimeout (/node_modules/@firebase/auth/dist/node/index-fe696f9c.js:1091:31)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
Authentication method is used in backend side ( NodeJS ) and below is the method
const { signInWithEmailAndPassword, signInWithCustomToken } = require("firebase/auth");
const { auth, db } = require("../../utils/firebaseClient");
signInWithEmailAndPassword(auth, email, password). // Failsexactly at this step
.then(async(userCredential) => {})
Import "getAuth" instead of "auth" and when you pass it into the signInwithEmailAndPassword method make sure to call it like:
signInwithEmailAndPassword(getAuth(), email, password)
Calling that getAuth function will make sure to get your default app's auth module instance, which is then used to login with the given email and password.