Skip to content

firestore:delete with database errors #6753

Closed

Description

@mboor-cloverleafai

Hi all,

Experiencing an issue with firestore:delete here. Didn't see any current or previous issues when searching. Form completed below. The below issue persists anytime I try deleting collection from a specific database. I can always delete from firestore db: (default) just fine with cli, but not when specifying another db.

[REQUIRED] Environment info

firebase-tools: 13.2.1

Platform: macOS

Node: 20.10.0

[REQUIRED] Test case

When running cli command for a firestore:delete with database the command errors out with "Error: Deletion failed."

Example command:
firebase firestore:delete --project projectNameHere --database test-db --shallow testCollection

Error:
Error: Deletion failed. Errors: Failed to fetch documents to delete >= 3 times..

[REQUIRED] Steps to reproduce

  1. Create a new db on your gcp project
    a.) firebase firestore:databases:create test-db --project projectNameHere --location nam5
  2. Go into created db on gcp firestore
  3. Create a collection named testCollection
  4. Create a blank document
  5. Run firestore:delete command
    a.) firebase firestore:delete --project projectNameHere --database test-db --shallow testCollection
  6. You should see error message

[REQUIRED] Expected behavior

The deletion works successfully so long as the database and the collection exist. Collection from correct firestore db is then deleted of all documents.

[REQUIRED] Actual behavior

The command errors out

Activity

  1. changed the title [-]firebase:delete with database errors[/-] [+]firestore:delete with database errors[/+] on Feb 8, 2024
  2. aalej commented on Feb 13, 2024

    @aalej
    Contributor

    Hey @mboor-cloverleafai, thanks for the detailed report, it is highly appreciated. I was able to reproduce this issue. Let me notify our engineering team about this so they can take a look. I’ll also mark this as reproducible.

  3. kartikwatwani commented on Jul 3, 2024

    @kartikwatwani

    Any updates on this?

  4. cgwyllie commented on Jun 3, 2025

    @cgwyllie

    We ran into a similar problem as well.

    After passing --debug to the command we could see that the deletion request is sent for the correct document IDs from our --database argument, but to the wrong URL for commit: it uses the (default) database and gets a 400 error.

    After tracing the --database option being passed through the command, it appears we end up here:

    const url = "projects/" + project + "/databases/(default)/documents:commit";

    This function does not take or respect any database option and has a hard-coded (default) database in the path.

  5. self-assigned this
    on Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions