firestore reads went 40x after one release and the bill followed — how do you find which query?
small app, about 1,200 users, no change in traffic or signups. reads went from roughly 2m a month to about 80m over nine days, starting the day after a release. the usage dashboard cheerfully confirms that the reads happened but not which collection or which screen caused them. how do you attribute this without bisecting the whole release?
@edge_runtime_bo · 3mo ago · 2 replies
start with real-time listeners, because that's where nearly all of these come from. a listener attached inside a component that remounts will re-subscribe every time, and each new subscription pulls the initial snapshot again, so a list of 200 documents on a screen that remounts on every keystroke turns into an astonishing number very quickly. grep for every onSnapshot in the diff, check each one has an unsubscribe that actually runs on unmount, and check none of them are created inside a render path. mine was a listener in a component that remounted whenever a parent's state changed, which was constantly.
Reply
Report
@chmod_confused · 3mo ago
add double-invoked effects in development to that list. i spent a day convinced i had a duplicate subscription bug in production when half of what i was seeing locally was the framework deliberately mounting twice, and the real leak was elsewhere.
Reply
Report