Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useFirestoreQuery() - duplicate firebase SDK #83

Closed
dorianbucknor opened this issue Dec 16, 2022 · 1 comment
Closed

useFirestoreQuery() - duplicate firebase SDK #83

dorianbucknor opened this issue Dec 16, 2022 · 1 comment

Comments

@dorianbucknor
Copy link

dorianbucknor commented Dec 16, 2022

When I try to use useFirestoreQuery(),
firebase.js

import { initializeApp  } from "firebase/app";
import { getFirestore } from "firebase/firestore";
...
const app = initializeApp(firebaseConfig);
const firestore = getFirestore(app);
export { auth, storage, firestore };

Events.jsx

import { firestore } from "../../utils/firebase";
...
const eventsCollection = collection(firestore, "events");
const eventsQuery = query(eventsCollection, where("published", "==", true));
const events = useFirestoreQuery("posts", eventsQuery);

I get this error:

error - unhandledRejection: [FirebaseError: Type does not match the expected instance. Did you pass a reference from a different 
Firestore SDK?] {
  code: 'invalid-argument',
  customData: undefined,
  toString: [Function (anonymous)]
}

package.json

...
"dependencies": {
    ...
    "@react-query-firebase/firestore": "^1.0.0-dev.7",
    ...
    "firebase": "^9.15.0",
    ...
    "next": "13.0.4",
    "react": "18.2.0",
    ...
    "react-query": "^3.39.2",
    ...
  },
...

I do not get this error when using Firestore by itself.

@dorianbucknor dorianbucknor changed the title useFirestoreQuery() not working with firebase useFirestoreQuery() - duplicate firebase SDK Dec 18, 2022
@dorianbucknor
Copy link
Author

Same as #68.
Can anyone please look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant