Skip to content

[bigquery-firestore-export kit] Changing INSTANCE_ID creates a second scheduled query and leaves the first running #2973

Description

@IzaakGough

In the bigquery-firestore-export kit (@firebase/bigquery-firestore-export, on the kits branch), changing INSTANCE_ID after a first deploy creates a second BigQuery scheduled query and leaves the first one running and billable.

Cause

Every runtime name comes from the INSTANCE_ID param (kits/bigquery-firestore-export/src/config.ts): the topic the lifecycle task creates, the topic the trigger subscribes to, the topic Data Transfer notifies, and the extInstanceId field stamped on the config document. The key in the instances map only names the deployed resources, so the two can differ without anything failing.

handleUpsertTransferConfig looks up the existing config with where("extInstanceId", "==", instanceId) (src/handlers.ts). Once INSTANCE_ID changes, that query misses and the lifecycle task creates a new scheduled query. The old one stays enabled and scheduled, notifying a topic with no subscriber, with its own Firestore documents alongside. Nothing reports it.

What happens

Deployed on a live project with map key robusta and INSTANCE_ID=robustb, which worked end to end. Correcting INSTANCE_ID to robusta produced a second transfer config, and the first was left enabled with a next run scheduled.

Fix

Most likely documentation, since nothing links an old config to a new id. A CLI-side check that INSTANCE_ID matches the instance map key would catch the mismatch, since the CLI knows the key and the kit does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions