Firestore data in emulator not showing up in emulator UI
See original GitHub issue[REQUIRED] Environment info
firebase-tools:
$ firebase --version
8.4.2
$ node -v
v10.16.3
Platform: macOS
[REQUIRED] Test case
index.js
const admin = require('firebase-admin');
process.env.FIRESTORE_EMULATOR_HOST = 'localhost:8080';
admin.initializeApp();
let db = admin.firestore();
async function test() {
let docRef = db.collection('users').doc('alovelace2');
let setAda = docRef.set({
first: 'Ada',
last: 'Lovelace',
born: 1815
});
}
test()
package.json
{
"name": "firebase-emulator-ui-test",
"version": "1.0.0",
"main": "index.js",
"author": "Chris Hager <chris@linuxuser.at>",
"license": "MIT",
"dependencies": {
"firebase-admin": "^8.12.1"
}
}
I simply created a new directory, initialise firebase with firebase init
and the node project with yarn init
, and added firebase-admin
(yarn add firebase-admin
).
[REQUIRED] Steps to reproduce
- Run the code above. Adding multiple entries to the firestore works, and I can retrieve them in code.
[REQUIRED] Expected behavior
Firebase UI at http://localhost:4000/firestore should show the data.
[REQUIRED] Actual behavior
Firebase UI at http://localhost:4000/firestore shows only an empty root.
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (3 by maintainers)
Top Results From Across the Web
Why don't I see data in the Firebase Cloud Firestore Emulator ...
If tests use this project ID, their data is visible in the emulator. If they use some other, tests work but the emulator...
Read more >Connect your app to the Cloud Firestore Emulator - Firebase
Connect your app to the Cloud Firestore Emulator · Choose a Firebase project · Instrument your app to talk to the emulators ·...
Read more >The Full Guide on how to use the Firebase Emulator for the Web
Once you added all the data to Firestore if you stop the emulator and start it again, it will start empty, so you'd...
Read more >Meet the Firestore Emulator Requests Monitor
You can access the Requests Monitor right now from the Emulator UI if you have the latest Firebase CLI running. (If not, it's...
Read more >Firebase Emulators Setup - Tips to overcome trouble, hurdles ...
It is possible, being busy with hooking up your frontend to the firestore emulator host, you accidently have terminated your terminal, expecting ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Found the answer – when calling
admin.initializeApp()
you need to set the correctprojectId
, then the data will show up.@charles-allen you’ve got it exactly right. A fake project ID will allow database writes but not much else. If you want to start the Emulator Suite with a fake project ID just do this: