Open yukihiroK opened 2 years ago
Hi, thanks for filing this issue! Technically speaking, the Firestore Emulator does evaluate rules per listener since they may lead to different results (depending on query / auth / etc.), but I can totally see how this can be noisy.
I'm filing an internal bug for some better way to group / clean this up. We are unable to promise any timeline for this, but if others also have this request, adding a +1 on this issue can help us prioritize adding this to the roadmap.
(Googler-only internal tracking bug: b/226158969)
I just encountered the exact same problem. Any news on a fix? Do the problem only affect the emulator?
I just encountered the exact same problem. Any news on a fix? Do the problem only affect the emulator?
This is an emulator-only issue. Just to clarify, this emulator-only view in the Emulator UI shows one entry per rules evaluation, which happens for each listener per request.
+1
I just ran into this as well. Before seeing this issue, I assumed there was a problem with my code that would ultimately produce tons of extra requests and, therefore, a significantly higher GCP bill (I'm still a little bit paranoid about it).
In the meantime, it would be much appreciated if you could explain in a little bit more detail why this is happening... Thank you!
+1 I'm also experiencing this issue with Firestore snapshots in the emulator. Resets when the emulator is restarted. Also gave me a scare re the GCP bill!
+1
+1 This problem is interfering with the prediction of the number of requests, and I think it is a problem that scares the programmers and makes them lose potential paying users in the future.
1+. I have the same issue. Even tho in the Network tab on the browser only shows one request, it keeps incrementing when I delete users and add new users (where these users has its own collectioon on firestore)
+1
+1
When you fetch data using the firebase/firestore library in a browser, the request will appear in the monitor. However, when subscribing to changes via the onSnapshot method, somehow multiple identical requests appear in the monitor. Since these
request.times
are slightly different, it may be that the rule evaluation has been performed multiple times. This number of times increases by one each time you reload the page. It then returns to zero by restarting the emulator.Note that the first read of onSnapshot is not a problem. The subsequent request when subscribing to the changes is the problem.
[REQUIRED] Environment info
firebase-tools: 10.3.1
Platform: macOS Big Sur 11.6.4
[REQUIRED] Test case
I made a sample project to reproduce this problem. https://github.com/yukihiroK/firestore-sample
Listen to a specific document or collection with the onSnapshot method and make changes to that document on the Firestore.
[REQUIRED] Steps to reproduce
Use the sample program above.
/(root)/collection/document/sub/doc1
on the firestore.firestore.rules
file to allow reading and writing to the document.http://localhost:3000/
.http://localhost:4000/firestore/requests
[REQUIRED] Expected behavior
I think the rule evaluation should be done only once, like when the page has never been reloaded.
[REQUIRED] Actual behavior