firebase / firebase-tools-ui

A local-first UI for Firebase Emulator Suite.
https://firebase.googleblog.com/2020/05/local-firebase-emulator-ui.html
Apache License 2.0
270 stars 62 forks source link

No collection/docs visible in firestore emulator, but data exists #482

Open rublev opened 3 years ago

rublev commented 3 years ago

image

If I manually create the "scraper/categories" collection/document then it works fine, but initially the UI is just blank.

Any reasons why? I already tried firebase --project="project" emulators:start in the commandline along with putting the project id in the "initializeApp" function but nothing works to initially show me the data. This is data imported locally from my live database. It all works fine and it's all there I just have to manually create the initial path every time.

yuchenshi commented 3 years ago

Just to clarify, what do you mean by "just blank"? Is it totally blank or stuck on loading screen? Or is it showing a functional Firestore view, but with no collections in it?

Are you using the latest Firebase CLI build? Please double check the version number and refresh the page after update. If things still don't work, please kindly generate an HAR file from your browser and upload it.

rublev commented 3 years ago

Just to clarify, what do you mean by "just blank"? Is it totally blank or stuck on loading screen? Or is it showing a functional Firestore view, but with no collections in it?

Are you using the latest Firebase CLI build? Please double check the version number and refresh the page after update. If things still don't work, please kindly generate an HAR file from your browser and upload it.

I'm using latest everything. In the emulator the root documents are missing, I have to always create the root collection manually and then everything else shows up. It's showing a functional firestore view, with no collections in it (despite the documents existing as my frontend fetches them locally/in prod just fine).

marcopandolfo commented 3 years ago

I'm having the same problem here

lucasmarinzeck commented 3 years ago

I have been struggling with this same problem for some days, looks like it connects somewhere, but not the right localhost firestore

JoeEarly commented 3 years ago

Can report the same, came to open a bug report and found it :) Screenshot 2021-02-08 at 15 29 52 Screenshot 2021-02-08 at 15 29 45

yuchenshi commented 3 years ago

@JoeEarly Thanks for the screenshot! This seems to narrow the problem down to the Firestore Emulator, where we're seeing 503 (Service Unavailable) -- that's something new.

For anyone experiencing this, would you mind attaching your firestore-debug.log when this happens again? (FYI It's firestore-debug, which will likely contain the stack trace of that error in the Java process of Firestore Emulator.)

yuchenshi commented 3 years ago

Is anyone still experiencing this problem? Any chance to grab the firestore-debug.log for us to troubleshoot?

j0hnsmith commented 3 years ago

566 is one cause of this

MorenoMdz commented 2 years ago

566

I have the same error only when loading a DB dump from our prod Firestore, it was working fine until a few days ago, now it only loads blank in the emulator UI. The data is there as I can still query it all, just the UI is not loading it.

The emulator logs keep throwing errors like:

logger.ts:115 [2022-06-20T22:27:25.891Z]  @firebase/firestore: Firestore (8.8.1): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

image

polymer-coder commented 2 years ago

566

I have the same error only when loading a DB dump from our prod Firestore, it was working fine until a few days ago, now it only loads blank in the emulator UI. The data is there as I can still query it all, just the UI is not loading it.

The emulator logs keep throwing errors like:

logger.ts:115 [2022-06-20T22:27:25.891Z]  @firebase/firestore: Firestore (8.8.1): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

image

Similar issue on my end except even if I manually create a document, it just doesn't show up.

jmagaram commented 1 year ago

oops! the problem was the name of my project in the firebase config was spelled wrong by one dinky character. so I thought I was using the exact same project name when running the emulator and inside my project but I was wrong. so it is working for me now.

I'm having the same issue. Have tried many different things but nothing works. Data exists in my app but not shown in the emulator. Have tried:

My log file...

Feb 09, 2023 4:17:38 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start
INFO: Started WebSocket server on ws://127.0.0.1:9150
API endpoint: http://127.0.0.1:8080
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:

   export FIRESTORE_EMULATOR_HOST=127.0.0.1:8080

Dev App Server is now running.

Feb 09, 2023 4:18:02 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketChannelHandler initChannel
INFO: Connected to new websocket client
Feb 09, 2023 4:18:41 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Multiple projectIds are not recommended in single project mode. Requested project ID demo-hotkey-pro, but the emulator is configured for demo-hotkeys-pro. This warning will become an error in the future. To opt-out of single project mode add/set the '"single_project_mode": false' property in the firebase.json emulators config.
Feb 09, 2023 4:18:41 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Feb 09, 2023 4:18:41 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Feb 09, 2023 4:18:47 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketChannelHandler initChannel
INFO: Connected to new websocket client
Feb 09, 2023 4:18:47 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Feb 09, 2023 4:18:47 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketChannelHandler channelClosed
INFO: Websocket client disconnected
Feb 09, 2023 4:18:47 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketChannelHandler initChannel
INFO: Connected to new websocket client
Feb 09, 2023 4:18:47 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.

How to debug this?

berengamble commented 1 year ago

For me, I had the exact same symptoms.. data existed but wasn't visible in the UI. It was because of my app context.

tldr; You need to pass your initialized app to firestore when you instantiate it

The Fix

I changed my code from

initialize_app()
db = firestore.Client()

to

app = initialize_app()
db = firestore.Client(app.project_id)

More info:

It was caused by this error which I saw when I ran firestore emulators:start --debug

[2023-06-01T18:26:26.857Z] Multiple projectIds are not recommended in single project mode. Requested project ID google-cloud-firestore-emulator, but the emulator is configured for my-project-id. To opt-out of single project mode add/set the '"singleProjectMode": false' property in the firebase.json emulators config.
deanbiltup commented 2 weeks ago

Where are logs for ui that connects to emulator? console shows no errors for me. Request shows creates/updates/list/get all success. Everything works fine except I see no data ever in the UI :( :( :( . I am blind as to what data is there. I am not even sure I can delete it. I could not use 8080 and changed to host firestore on 8000 so perhaps that is an issue??? My webapp is using 8080 already (I was surprised you pick firestore to host on 8080 since many servers start up on that port). I would assume the UI is connecting to port 8000 though since it sees the requests/responses and just can't load data for some reason :( .

VERSION 10/21 12:31 firestore-emulator % firebase --version 13.22.1

Screenshot 2024-10-21 at 12 51 12 PM Screenshot 2024-10-21 at 12 52 01 PM
deanbiltup commented 2 weeks ago

I am confused by your comment @berengamble If your app is working saving and reading data, why would you need to change your app? It would seem to me that the UI would need a fix not your app?

deanbiltup commented 2 weeks ago

Running firebase --debug emulators:start results in a ui-debug.log of only 2 lines(lmao) so very unhelpful there -> Web / API server started at 127.0.0.1:8001 Web / API server started at ::1:8001

Does the UI connect from browser to emulator or server to emulator?

TRICKY, this is only seen in dev chrome tools console if you go back to overview and then click 'go to firestore emulator' ->

Is this related though again, the requests/responses are all loaded just fine.

FirestoreEmulatedApiProvider.tsx:56 [2024-10-21T09:58:22.389Z] @firebase/app: Firebase: Firebase App named 'firestore component::0.864407831923903' already deleted (app/app-deleted). b0e @ index.esm2017.js:78 warn @ index.esm2017.js:157 pEe @ index.esm2017.js:830 await in pEe read @ index.esm2017.js:1064 await in read vEe @ index.esm2017.js:898 (anonymous) @ index.esm2017.js:1137 getOrInitializeService @ index.esm2017.js:290 getImmediate @ index.esm2017.js:128 Ub @ index.esm2017.js:273 aX @ index.esm2017.js:18942 (anonymous) @ FirestoreEmulatedApiProvider.tsx:56 (anonymous) @ firebase.ts:52 vA @ react-dom.production.min.js:243 Rv @ react-dom.production.min.js:285 hue @ react-dom.production.min.js:282 Hp @ react-dom.production.min.js:280 A3 @ react-dom.production.min.js:272 ep @ react-dom.production.min.js:127 (anonymous) @ react-dom.production.min.js:266 Show 17 more frames Show less