Short answer
Commit in chunks, for example 100 to 200 documents per batch, and lower that if the documents are large. For big imports and migrations in the Admin SDK, use BulkWriter, which sends many writes in parallel without one giant request. Large fields you never query can also be left out of indexing to shrink each write.
Rather not fix it yourself? App Fix Ticket starts with a fixed-price diagnosis, then a fixed price for the fix before any fix work.
Why the write is too big, and the fix
01
The batch is over 10 MiB
“The transaction exceeded the maximum request size of 10 MiB.” Firebase, Transactions and batched writes
One commit carries every write in the batch or transaction. Many documents, or a few large ones, push it over the limit.
02
Index entries count too
“Transaction size depends on the sizes of documents and index entries modified by the transaction.” Firebase, Transactions and batched writes
Every indexed field adds index entries to the write. Arrays and maps with many values add many entries. Exempt large fields you never query from indexing.
03
Split the writes into chunks
Commit a batch, start a new one, and repeat. Batches commit one at a time, so write the job to be safe to run again if it stops halfway. This works for batched writes. A transaction can’t be split this way, so make it touch fewer documents.
// Web SDK const CHUNK = 200; for (let i = 0; i < items.length; i += CHUNK) { const batch = writeBatch(db); for (const item of items.slice(i, i + CHUNK)) { batch.set(doc(db, 'products', item.id), item); } await batch.commit(); }04
Use BulkWriter on the server
“A Firestore BulkWriter that can be used to perform a large number of writes in parallel.” Google Cloud Node.js client, BulkWriter
For imports, backfills and deletes in the Admin SDK, BulkWriter handles the batching and retries for you.
import { getFirestore } from 'firebase-admin/firestore'; const db = getFirestore(); const writer = db.bulkWriter(); writer.onWriteError((err) => err.failedAttempts < 3); // retry up to 3 times for (const item of items) { writer.set(db.collection('products').doc(item.id), item).catch((err) => console.error(item.id, err)); } await writer.close();05
The 500-write rule is out of date
“Maximum API request size 10 MiB” Firebase, Quotas and limits
Older answers say a batch can hold 500 writes. Firebase’s current limits page lists no such count, only a request size, so a batch of small documents can hold more and a batch of large ones less.
Checked against the vendor’s docs on : Firebase docs: Transactions and batched writes; Firebase docs: Quotas and limits; Google Cloud: Firestore Node.js BulkWriter.
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
“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
Related: Firestore ALREADY_EXISTS · Firestore quota exceeded · Firestore deadline exceeded · Firestore invalid document reference · Firestore document too large