Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

firebase: can't find variable IDBIndex

I'm developing an app with react-native (v0.60) and I need push notifications. I decided to use firebase as service but I have an error during initialisation.

Code:

import {AppRegistry} from 'react-native';
import Config from 'react-native-config'
import * as firebase from 'firebase/app'
import '@firebase/messaging'

import firebaseConfig from 'App/src/firebase.config'
import App from './App';
import {name as appName} from './app.json';

firebase.initializeApp(firebaseConfig)
const messaging = firebase.messaging()
messaging.usePublicVapidKey(Config.FIREBASE_KEY_PAIR)

AppRegistry.registerComponent(appName, () => App);

The problem is that I get the error:

ReferenceError: Can't find variable: IDBIndex

How can I fix this?

like image 856
ste Avatar asked Oct 23 '19 08:10

ste


2 Answers

firebase only supports Authentication, Firestore & Realtime databases, Storage, and Functions on React Native. Other modules like Analytics are not supported through the Firebase JS SDK, but you can use expo-firebase-analytics for that. If you'd like access to the full suite of native firebase tools

please remove firebase.analytics();

like image 158
mehardeep s Avatar answered Oct 19 '22 18:10

mehardeep s


It's because you have enabled Google Analytics for your app. Disable Analytics from the Firebase settings and again copy the Firebase file data from Firebase and replace it with the old firebase.js file in the project.

like image 1
ENG17CS0186-SAARTHAK moghe Avatar answered Oct 19 '22 19:10

ENG17CS0186-SAARTHAK moghe