NativeScript / NativeScript/firebase

[@nativescript/firebase-firestore] ERROR collectionWithPath #bug

Open
#279 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Initialize Firebase in app.js like this:
    import { firebase } from "@nativescript/firebase-core";
    import "@nativescript/firebase-firestore";
    
    firebase().initializeApp({
       showNotifications: true,
       showNotificationsWhenInForeground: true,
    });
    
    
  2. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.