NativeScript/firebase

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

kakha13 opened this issue · 0 comments

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