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?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.