Nativescript Firebase Plugin storage functions on NS7 error

135 views Asked by At

After upgrading to NS7, and updating my code imports, I am unable to use the firebase 'firestore' functions. Whenever any firebase storage function is called I receive: CONSOLE ERROR: ERROR TypeError: Cannot read property 'listAll' of undefined

This same app is able to use successfully use firestore to retrieve collections and documents, but storage functions do not seem to be recognized.

app.component.ts

import { firestore, storage } from "@nativescript/firebase";

 storage.listAll({
        bucket: "gs://appname-xxxx.appspot.com",
        remoteFullPath: ""
      }).then(
          function (result) {
              console.log(JSON.stringify(result));
          },
          function (error) {
              console.log(error);
          }
      );

firebase.nativescript.json

{
    "using_ios": true,
    "using_android": false,
    "analytics": true,
    "firestore": true,
    "realtimedb": false,
    "authentication": true,
    "remote_config": false,
    "performance_monitoring": false,
    "external_push_client_only": false,
    "messaging": false,
    "in_app_messaging": false,
    "crashlytics": true,
    "storage": true,
    "functions": false,
    "facebook_auth": true,
    "google_auth": true,
    "admob": false,
    "dynamic_links": false,
    "ml_kit": false
}
1

There are 1 answers

0
Yong On

try the following import format

import { storage } from "@nativescript/firebase/storage";

This will avoid "undefined"