For my local development i installed the firebase emulators through firebase cli. Now i want my project to connect to the emulated firebase.
The connection to emulated Auth is already running fine.
I'm trying to use "useEmulator" on my firebase.firestore() My code is basically from the Docs (https://firebase.google.com/docs/emulator-suite/connect_firestore#web)
const db = firebase.firestore()
const auth = firebase.auth()
if (location.hostname === "localhost") {
console.log('LOCAL')
auth.useEmulator("http://localhost:9099")
db.useEmulator("localhost", 8080)
}
I get this error Uncaught TypeError: s.useEmulator is not a function
On this line: db.useEmulator("localhost", 8080)
What point did i miss? Thanks for help!
I got this hints on slacks firebase community:
Making sure your SDK version supports "useEmulator" (https://firebase.google.com/support/release-notes/js) or use this code for older versions:
FirebaseService.db.settings({
host: 'localhost:8080',
ssl: false,
experimentalForceLongPolling: true,
})