Skip to content

Cannot delete a collection with firestore:delete due to HTTP Error 429 #7845

Closed

Description

@Desno365

[REQUIRED] Environment info

firebase-tools: 13.22.0

Platform: macOS

[REQUIRED] Test case

When running firebase firestore:delete -r "collectionId" on a very big collection (~100'000 documents) composed of very large documents (~1MB) the command fails.
The error reported is the following:

HTTP Error: 429, This database has exceeded their maximum bandwidth for writes, please retry with exponential backoff.

It becomes impossible to delete the collection.

[REQUIRED] Steps to reproduce

  1. Create a collection composed of many documents (>100'000), where each document has a very large size (~1MB).
  2. Run firebase firestore:delete --debug -r "collectionId"

[REQUIRED] Expected behavior

The expected behavior is that the collection "collectionId" is deleted successfully.

[REQUIRED] Actual behavior

The actual behavior is that the collection is not deleted. At the moment it's impossible to delete the collection.

Activity

  1. NickChittle commented on Oct 22, 2024

    @NickChittle
    Contributor

    Hello, thanks for reporting this, it looks like the Firebase CLIs implementation of delete does not do rampup/retries with exponential backoff on this bandwidth error, which it looks like you would be hitting because the documents you're trying to delete are fairly large.

    While we look into this, you could try using one of the recursive delete methods in the SDKs, for example in python: https://github.com/googleapis/python-firestore/blob/3fe727102d1a4f65c9b8767d11015d8baaead355/google/cloud/firestore_v1/client.py#L297

    db = firestore.Client(project=PROJECT_ID, client_options=options)
    bulk_writer = db.bulk_writer()
    coll_ref = db.collection(COLLECTION_ID)
    print(f"Deleting {COLLECTION_ID}")
    db.recursive_delete(coll_ref, bulk_writer=bulk_writer)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions