Skip to content

Can't find variable: IDBIndex #2801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kresogalic8 opened this issue Mar 26, 2020 · 2 comments
Closed

Can't find variable: IDBIndex #2801

kresogalic8 opened this issue Mar 26, 2020 · 2 comments

Comments

@kresogalic8
Copy link

Hello, after implementation of analytics in react native, i am getting this error Can't find variable: IDBIndex

This is my firebase initialisation:

import * as firebase from 'firebase';
import 'firebase/analytics';

import config from '../env/development.env';
import configProd from '../env/production.env';

if (!firebase.apps.length) {
    firebase.initializeApp(configProd);
}

export default firebase;

and this is my log event

Firebase.analytics().logEvent('page_view');

@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@Feiyang1
Copy link
Member

FirebaseAnalytics doesn't work in React Native. The error you see is one of the several reasons why it doesn't work in non-browser envs.
See #2243

Just want to point out that you should replace the first line with import * as firebase from 'firebase/app', then import individual products like you are already doing.
Importing firebase directly pulls in all firebase products including the ones you don't use.

@firebase firebase locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants