nodejs-firestore icon indicating copy to clipboard operation
nodejs-firestore copied to clipboard

BulkWriter: DEADLINE_EXCEEDED error when deleting documents in single collection

Open krymen opened this issue 8 months ago • 1 comments

When using BulkWriter to delete 5,000 documents simultaneously from a single collection, I’m getting the following error:

4 DEADLINE_EXCEEDED: Deadline exceeded after 72.021s,metadata filters: 0.001s,remote_addr=173.194.64.95:443

Despite the BulkWriter returning the deadline exceeded error, all the documents are eventually deleted.

Additionally, I’ve noticed that the default error handler function in BulkWriter doesn’t retry the DEADLINE_EXCEEDED error (config). However, this error can be retried for single deletion operations according to the configuration.

Environment details

  • Node.js version: 22.13.0
  • npm version: 10.9.2
  • @google-cloud/firestore version: 7.11.0

krymen avatar Apr 25 '25 16:04 krymen

Thanks for reporting @krymen . I wasn't able to reproduce the DEADLINE_EXCEEDED error on my toy project even though I had a very large number of large documents. That's probably due to the nature of this error.

Point taken on the retryable codes. Since the BulkWriter is using BatchWrite, it's using the retryable error codes from BatchWrite, but perhaps it makes sense to adopt the DeleteDocument retrable codes for deletion operations. I'll bring this up with the team.

In the meantime, please feel free to use onWriteError to best suit your needs.

ehsannas avatar Apr 25 '25 22:04 ehsannas