Skip to content

deploy with --dry-run still changes production (Firestore) #11491

Closed

Description

@inlined

[REQUIRED] Environment info

firebase-tools:

15.22.0

Platform:

MacOS 26.6.2

[REQUIRED] Test case

Create a firebase.json with:

{
  "firestore": {
    "database": "custom-name",
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  }
}

[REQUIRED] Steps to reproduce

DO NOT create the database manually (or ensure it is deleted with glcoud first)

Run firebase deploy --dry-run

[REQUIRED] Expected behavior

Validation on the syntax of the rules and indexes

[REQUIRED] Actual behavior

A database is created. It also creates the database in nam5 even though a deploy on an existing database would have detected which region the existing database is in.

What the heck was I doing to run into this?

In my CI pipeline, I want to make sure main holds as few things that can break prod as much as possible, so I have a terraform plan and firebase deploy --dry-run as a commit check. Terraform normally controls as much as possible so I provision Firestore there (where it sets a different region than NAM5). I had hoped that deploy --dry-run would let me add an extra check RE rules and index validation, but instead it breaks the CD pipeline because now the DB is created in a different location TF expects it.

Activity

  1. gauranshahuja commented on Nov 13, 2026

    @gauranshahuja
    Contributor

    I'd like to take this one.

    The cause is in src/deploy/firestore/prepare.ts: createDatabase() runs unconditionally during prepare, and prepare also runs for --dry-run (only the deploy phase is skipped in src/deploy/index.ts). So a missing database gets created for real, in nam5 when location is not set.

    Plan: with --dry-run, skip the create and log which database would be created and where, the same way the dataconnect and extensions prepare steps already branch on options.dryRun. Rules and index validation keep running. Unit tests for both paths.

    While reading it I noticed two smaller things in the same function. With an array of databases in firebase.json it only checks the first one, and a non-404 error from getDatabase is swallowed. Should I fix those in the same PR or keep this one to the dry-run fix?

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