Short answer
Find which operation timed out and how big it is. Split large reads with limit() and query cursors, and split big writes into smaller batches. If many writes go to documents with sequential IDs or a timestamp-ordered range, spread them out with auto-generated IDs. Ramp new traffic up gradually. Retry with backoff, but only writes that are safe to repeat, because a write that timed out may still have been applied.
Why Firestore timed out, and the fix
01
A read that returns too many documents
“Use pagination to split large reads.” Google Cloud, Resolve latency issues
A get() on a whole collection, or an export script that reads everything in one call, can run past the deadline as the data grows. Read in pages with limit() and startAfter(), and process each page before asking for the next.
let last = null; do { let q = db.collection('orders').orderBy('createdAt').limit(500); if (last) q = q.startAfter(last); const page = await q.get(); // process page.docs here last = page.docs[page.docs.length - 1] ?? null; } while (last);02
Writes piled onto a narrow range of documents
“Hot-spots (high read, write, and delete rates to a narrow document range) limit the ability of Firestore to scale.” Google Cloud, Resolve latency issues
Document IDs that count up (order-0001, order-0002) or start with a timestamp send every new write to the same spot in Firestore’s key range, and an indexed timestamp field does the same to its index. At high write rates that becomes a hot spot. Use auto-generated IDs from add() or doc(), and keep a high write rate off a single document such as a global counter.
03
Traffic that jumped all at once
“We recommend starting with a maximum of 500 operations per second to a new collection and then increasing traffic by 50% every 5 minutes.” Firebase, Best practices for Cloud Firestore
A launch, a migration or a backfill that sends full traffic to a new collection at once can time out while Firestore scales up. Start slower and increase step by step, and run backfills with a rate limit instead of as fast as the script can go.
04
Retrying a write that may have worked
“For operations that change the state of the system, this error may be returned even if the operation has completed successfully.” gRPC, Status codes and their use in gRPC
DEADLINE_EXCEEDED doesn’t prove the write failed. Retry with exponential backoff, but make the write safe to repeat first: set() with a known document ID, or a transaction that checks before it changes, so a retry doesn’t double charge or duplicate an order.
Checked against the vendor’s docs on : Google Cloud: Firestore error codes (DEADLINE_EXCEEDED); Google Cloud: Resolve Firestore latency issues; Firebase: Best practices for Cloud Firestore (ramping up traffic); gRPC: Status codes.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.See scope and start
Related: Firestore quota exceeded · Firestore “client is offline” · Cloud Functions memory limit exceeded · Firestore query requires an index