Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Track Firestore traffic/requests

To minimise unnecessary actions it is always good to see actual requests to the server.

It is easy to do with firebase realtime database, since it opens websocket and it can be viewed in chrome dev tools.

Firestore seems to be different. It's not clear what type of communication with the server it uses. I can not see anything related to my data while looking at websockets, seems it is using XHR requests, but by looking at this requests they have pretty weird data returned to me, for example it receives this response in the body:

10
[1,128,7]

..while I see that I loaded data.

So how to see my requests to firestore?

like image 357
ZuzEL Avatar asked Feb 17 '18 02:02

ZuzEL


1 Answers

The wire protocol for Cloud Firestore is based on gRPC, which is indeed a lot harder to troubleshoot than the websockets that the Realtime Database uses.

The best way I've found so far is to enable debug logging with:

firebase.firestore.setLogLevel('debug');

Once you do that, the debug output looks similar (for subjective values of "similar") to what you'd get from debug logging on the Realtime Database.

like image 114
Frank van Puffelen Avatar answered Sep 17 '22 17:09

Frank van Puffelen