NativeScript / NativeScript/firebase
[@nativescript/firebase-firestore] ERROR collectionWithPath #bug
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 62
- Forks
- 53
- Avg merge
- 8d 4h
- Merged PRs (30d)
- 2
Description
Bug Report: Cannot read properties of undefined (reading 'collectionWithPath') in Firebase Firestore
Description
When trying to fetch data from Firestore using firebase().firestore().collection("users"), the following error occurs:
However, initializing Firebase in App.vue instead of app.js resolves the issue.
Environment
- NativeScript-Vue:
3.0.0-rc.2 - @nativescript/firebase-firestore:
3.4.0-alpha.1 - Platform: (e.g., Android, iOS)
Steps to Reproduce
- Initialize Firebase in
app.jslike this:import { firebase } from "@nativescript/firebase-core"; import "@nativescript/firebase-firestore"; firebase().initializeApp({ showNotifications: true, showNotificationsWhenInForeground: true, }); - Fetch Firestore data in Users.vue
firebase()
.firestore()
.collection("users")
.orderBy("points", "desc")
.where("points", ">", 0)
.get()
.then((querySnapshot) => {
querySnapshot.forEach((documentSnapshot) => {
users.push({
...documentSnapshot.data(),
id: documentSnapshot.id,
});
});
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the initialization in app.js and the Firestore call in Users.vue, using the reported NativeScript-Vue and @nativescript/firebase packages as the reproduction context. Compare the behavior when initialization is placed in App.vue, then verify that fetching the users collection works from Users.vue with initialization kept in app.js.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- firebase, typescript
- Domain
- database, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100