Skip to content

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

Open
@kakha13

Description

@kakha13

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,
            });
        });
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions