I've been struggling to configure Firebase's V9 emulators with Next.js, but I keep running into the same error message. See it here: https://i.stack.imgur.com/Uhq0A.png
The current version of Firebase I'm using is 9.1.1
.
This is how my Firebase setup looks:
import { initializeApp, FirebaseApp } from "firebase/app";
import firebase from "firebase/compat/app";
import { getAuth, connectAuthEmulator, Auth } from "firebase/auth";
import {
getFirestore,
connectFirestoreEmulator,
Firestore,
} from "firebase/firestore";
import {
getStorage,
connectStorageEmulator,
FirebaseStorage,
} from "firebase/storage";
import {
getDatabase,
connectDatabaseEmulator,
Database,
} from "firebase/database";
let firebaseApp: FirebaseApp;
let auth: Auth;
let firestore: Firestore;
let storage: FirebaseStorage;
let db: Database;
if (!firebase.apps.length) {
firebaseApp = initializeApp(clientCredentials);
auth = getAuth(firebaseApp);
firestore = getFirestore(firebaseApp);
storage = getStorage(firebaseApp);
db = getDatabase(firebaseApp);
}
if (IS_DEV) {
connectFirestoreEmulator(firestore, "localhost", 8080);
connectAuthEmulator(auth, "http://localhost:9099", { disableWarnings: true });
connectDatabaseEmulator(db, "localhost", 9000);
connectStorageEmulator(storage, "localhost", 9199);
}
export { firebaseApp, auth, firestore, storage, db }
I have ensured that there are no calls to my firestore object, yet the error persists as soon as Next.js boots up.