angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Firebase errors on pull of collections and documents.

Open ethaneckstein opened this issue 10 months ago • 2 comments

Get these errors in the browser console.

"Error getting document at path ******: FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore"

and

"Error fetching user data: FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore"

Had to override firebase with this in the package.json to get it to pull documents from firebase db.

"overrides": { "firebase": "^12.7.0" },

ethaneckstein avatar Jan 12 '26 22:01 ethaneckstein

This was opened 6 months ago! Is anyone maintaining this?

ethaneckstein avatar Jun 26 '26 18:06 ethaneckstein

Thanks for the report, and sorry it took this long to get an answer.

This is the same problem as #3684, two copies of the firebase SDK installed side by side:

  • When a Firestore instance from one copy is passed to the collection() or doc() function of the other, the SDK's own type check fails with exactly this message.
  • In January, installing @angular/[email protected] next to a firebase 11 produced that dependency tree with no warning.
  • Your overrides entry collapsed it back to one copy, which is why it fixed the errors.

AngularFire 21.0.0 handles this for you: ng update @angular/fire@21 moves your firebase dependency to ^12.18.0 and reinstalls, so you can drop the override. If you still see this on 21.0.0 and npm ls firebase shows one firebase version, please open a new issue with that output.

I'm closing this as a duplicate of #3684, where the details live.

armando-navarro avatar Nov 05 '26 18:11 armando-navarro