When i look up this error its with flutter or React Native. All the the solutions I have come across did not help.
I have also done it like this ๐. If i do i get a - Maximum call stack size exceeded error
const app = firebase.initializeApp(firebaseConfig)
Any help will be appreciated.
import {firebase} from './firebase'
import {getFirestore} from 'firebase/firestore'
import {getStorage} from 'firebase/storage'
const firebaseConfig ={
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: ""
};
const db = getFirestore()
const storage = getStorage()
const app = !getApps().length ? initializeApp(firebaseConfig) : getApp()
export {db,storage,firebase,app}
I'm not totally sure what is being imported as firebase at the top, but you must initialize Firebase before any other service but currently it's the opposite way. Try refactoring the order of statements as shown below:
// import { firebase } from './firebase'
import { getFirestore } from 'firebase/firestore'
import { getStorage } from 'firebase/storage'
const firebaseConfig = {...};
// Initialize Firebase first
const app = initializeApp(firebaseConfig)
const db = getFirestore()
const storage = getStorage()
export {db, storage, firebase, app}
Also if that ./firebase file just has this statement firebase.initializeApp(firebaseConfig) which is older syntax then can you try removing the file?