0

Trying to use Firebase Analytics and Cloud FireStore... I've got it submitting to the FireStore, but I'm not sure why I'm getting this error:

Error

index.ts:79 TypeError: Cannot read property 'INTERNAL' of undefined
    at index.ts:41
    at index.ts:79
    at firebase-analytics.js:1
    at firebase-analytics.js:1
(anonymous) @ index.ts:79
(anonymous) @ firebase-analytics.js:1
(anonymous) @ firebase-analytics.js:1
index.ts:79 Uncaught Error: Cannot instantiate firebase-analytics.js - be sure to load firebase-app.js first.
    at index.ts:79
    at firebase-analytics.js:1
    at firebase-analytics.js:1

Firebase file

import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/analytics';

const firebaseApp = firebase.initializeApp({
    apiKey: 'XXXXXXXXXXXXXXXXXX',
    authDomain: 'XXXXXXXXXXXXXX',
    databaseURL: 'XXXXXXXXXXXXX',
    projectId: 'XXXXXXXXXXXXX',
    storageBucket: 'XXXXXXXXXXXXX',
    messagingSenderId: 'XXXXXXXXXXXXX',
    appId: 'XXXXXXXXXXXXX',
    measurementId: 'XXXXXXXXXXXXX',
});

export const db = firebaseApp.firestore();
firebase.analytics();

1 Answer 1

1

replace import firebase from 'firebase/app' with import * as firebase from 'firebase/app'

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.