NativeScript / firebase

Modular Firebase 🔥 implementation for NativeScript. Supports both iOS & Android platforms for all Firebase services.
https://docs.nativescript.org/plugins/firebase-core.html
Apache License 2.0
56 stars 50 forks source link

Firebase initialization error: crashlytics is not a function #262

Closed Bezlepkin closed 5 months ago

Bezlepkin commented 5 months ago

When using crashlytics, an error started appearing (it never happened before and worked fine).

(0 , _nativescript_firebase_core__WEBPACK_IMPORTED_MODULE_0__.firebase)(...).crashlytics is not a function

I use it like this:

import { FirebaseApp, firebase } from '@nativescript/firebase-core';
import { Crashlytics } from '@nativescript/firebase-crashlytics';

class FirebaseService {
  constructor() {
    firebase()
      .initializeApp()
      .then(async (app: FirebaseApp) => {
        firebase().crashlytics().setCrashlyticsCollectionEnabled(true);// <----- this a problem
        await this.initMessaging();
      })
      .catch((e: Error) => {
        console.error('Firebase initialization error: ', e.message);
      });
  }
}
...
triniwiz commented 5 months ago

A simple import '@nativescript/firebase-crashlytics'; should get things working 🤔

Bezlepkin commented 5 months ago

A simple import '@nativescript/firebase-crashlytics'; should get things working 🤔

When we transferring Firebase functionality from project to project they forgot to write it in main.ts import '@nativescript/firebase-crashlytics';

Thank you! It's working!