The Firestore bill arrived before the traffic did. Kata Jaam is an event-discovery product for Nepal, and its web side is three Next.js apps on Vercel that read from Firestore through the Firebase Admin SDK. The pages were cached. The users were a few thousand. The bill said something else was going on, and when I opened the usage tab in the Firebase console the graph agreed with the bill: about three million document reads a day, for pages that should have needed a small fraction of that.
If you are here because the Firebase Admin SDK on Vercel is running up your Firestore reads, the short version is that I ended up changing one setting, preferRest, and the reads fell back in line with traffic. The longer version is the order I looked in, because the first three places were wrong.
The graph that did not follow the traffic
A read graph normally looks like a traffic graph with a delay. Mine did not. The reads climbed on their own, between deploys, while the number of people opening pages stayed where it was. Three million a day is the kind of number that means a loop, not a crowd.
I had a cache in front of Firestore. That was the uncomfortable part. A cache that works does not produce a graph like that, so either the cache was not being hit or something under it was asking Firestore the same questions over and over.
The usual suspects
I went where I always go first. A query that had changed and was now scanning a collection. A cache key that varied per request, so every visit was a miss. A crawler hitting the event routes faster than any person would.
Each one took a while to rule out and none of them explained the volume. The queries were the same queries. The keys were stable. The crawl traffic was ordinary. Whatever was reading three million documents a day was doing it from inside my own functions.
What a warm instance carries
That was the question that turned it. On Vercel a function instance stays warm and is reused across invocations, and under Fluid Compute one instance can serve many requests and live a long time. Between bursts it can sit idle or be paused. So what does an instance carry from one invocation to the next?
The Firestore client, and under it the open gRPC channel.
By default the Admin SDK talks to Google over gRPC, which keeps a long-lived HTTP/2 channel open and reuses it. On a server that never sleeps, that is exactly what you want. On an instance that pauses between bursts, the network path under that channel can be dropped and the client does not always find out. A request goes out on a channel the client believes is alive, and stalls. It waits to its deadline and retries. Code that treats a slow or failed read as a cache miss falls through and reads again. A streaming read that drops and reconnects fetches its whole result set again, and every document counts.
Put enough warm instances through that loop and a cache becomes a stampede. I have not confirmed which of those steps dominated in my case. I did not need to. The one thing those instances carried that nothing else explained was the channel.
One flag
The Firestore client accepts a setting that makes it use REST instead of gRPC wherever it can. A REST request is a plain HTTPS call with nothing long-lived to go stale between invocations. It has to be set once, before the first read or write:
import { getFirestore } from "firebase-admin/firestore";
const db = getFirestore();
db.settings({ preferRest: true });
Calling settings a second time on the same instance throws, so it lives in the one module that creates the client and every route imports. Operations that need a stream, such as real-time listeners, still use gRPC with the flag on. For request and response reads from a Next.js route, REST is the whole path. The trade is a little latency per call, since there is no warm channel to reuse.
I deployed that one change and nothing else, so the graph would have one explanation.
What the graph did
The bill lags, so I watched the read count instead. Over the following days the daily reads fell from about three million back in line with traffic, and the bill settled at a flat rate. Nothing about the pages changed. Nothing about the cache changed. The questions being asked of Firestore were the same questions; they were just being asked once.
If you make the same change and your reads do not move, the transport was not your problem, and the queries deserve another look.
What I would check first now
Before any of the above, I would ask a Next.js app on Vercel five things. Does the read count follow traffic, or climb on its own between deploys? Is the Firestore client created once per instance, or on every request? What does the cache do when a read is slow or fails: does it count that as a miss and read again? Is any route holding a listener or a stream open inside a function? And is preferRest set, before the first call?
More than one uncomfortable answer is enough to justify a single-change test.
The rule it became
It is now one of the written decisions for Kata Jaam: keep the Admin SDK on REST on Vercel. The bill was the expensive way to learn it. The sentence in the decisions file is the cheap way to keep it.
I build mobile and web products end to end, including the parts under the cache, on build my app or product.