Firebase Emulators Requests to local FireStore unsuccessful
Hello,
I am trying to setup the Firebase Emulators and my app is still connecting to Firebase(web). When I do a db.collection("users").add(), I see the entry on https://console.firebase.google.com not on http://localhost:4000/firestore (host port is 8080, viewer port is 4000)
Here is what I have done to far:
Firebase emulators:start returns "All emulators are ready!"
Firebase.json looks fine (ports look ok)
"emulators": {
"functions": {
"port": 5001
},
"firestore": {
"port": 8080
},
"database": {
"port": 9000
},
"hosting": {
"port": 5000
},
"pubsub": {
"port": 8085
},
"ui": {
"enabled": true
}
- Before initializing the App, I change databaseURL to my local firestore. Note that in the video "The Local Firebase Emulator UI in 15 minutes" (https://www.youtube.com/watch?v=pkgvFNPdiEs 5:19) David East replaces the whole config objects by "config = { databaseURL: '...' }" but it returns this error: "Uncaught FirebaseError: "projectId" not provided in firebase.initializeApp" and if I add the value-key projectId, it returns lost of additional errors.
if (location.hostname === "localhost") {
config.databaseURL = "http://localhost:8080?ns=project_name";
}
firebase.initializeApp(config);
- Firebase using good project (Firebase Firestore works with real database but not emulator)
firebase use project_name
- I also created Google Cloud Platform private key... just in case.
I think my problem might be in step 3 but I can't find how to fix it. Have you got any idea? What do you do to make it work?
Thank you!