Nativescript-plugin-firebase: Make sure 'firestore' is enabled in 'firebase.nativescript.json'

Created on 1 Nov 2019  路  3Comments  路  Source: EddyVerbruggen/nativescript-plugin-firebase

Actual Behavior

I'm trying to access something from Firestore and I got this error
ERROR Error: Make sure 'firestore' is enabled in 'firebase.nativescript.json', then clean the node_modules and platforms folders

Here is my firebase.nativescript.json file
{ "using_ios": true, "using_android": true, "analytics": false, "firestore": true, "realtimedb": true, "authentication": false, "remote_config": true, "performance_monitoring": true, "external_push_client_only": true, "messaging": true, "in_app_messaging": true, "crashlytics": true, "storage": true, "functions": true, "facebook_auth": false, "google_auth": false, "admob": false, "dynamic_links": false, "ml_kit": false }

Expected Behavior

As it is clearly mentioned in configuration file that firestore : true It should not show this error and get data from Firestore

Steps to reproduce this error

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'ns-homepage',
  templateUrl: './homepage.component.html',
  styleUrls: ['./homepage.component.css']
})
export class HomepageComponent implements OnInit {
  dt = "";
  firebase = require('nativescript-plugin-firebase/app');

  constructor() {
    this.firebase.initializeApp()
      .then(() => console.log(`working as expected%%%%%%%%%%%%%`))
      .catch((err) => console.log(`%%%%%%%%%%%% ${err}`))
  }

  ngOnInit() {
  }
  onSubmit(event) {
    this.dt = event;
  }
  Firebase() {
    this.firebase.firestore().collection('Users').get().then(d => {
      this.dt = d;
    }).catch((er) => {
      this.dt = er;
    })
  }

}

Most helpful comment

What's the command used to run this app? If it's not using the preview command (which you shouldn't) then make sure to remove the platforms and node_modules folders. Then run again.

All 3 comments

What's the command used to run this app? If it's not using the preview command (which you shouldn't) then make sure to remove the platforms and node_modules folders. Then run again.

Well I was trying to use tns preview command actually. Do I need build ?

Yeah, the Preview wrapper app doesn't come with the Firebase plugin installed so you can't use it.

Was this page helpful?
0 / 5 - 0 ratings