Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore with proper imports

Viewed 9

I am getting this weird error in firebase when trying to query my firestore database. I am initializing my app with the following code:

const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const db = getFirestore(app);

my initializations:

import { initializeApp } from "firebase/app";
import {GoogleAuthProvider, getAuth, signInWithPopup, signInWithEmailAndPassword, createUserWithEmailAndPassword, sendPasswordResetEmail, signOut} from "firebase/auth";
import { getFirestore, query, getDocs, collection, where, addDoc } from "firebase/firestore";

I also try to run the query in these two ways and get the same error for both.

let userDocs = query(collection(db, 'users'))

and

let userDocs = (collection(db, 'users'))

Any help would be great

0 Answers
Related