fix(firestore-bigquery-change-tracker): preserve BigQuery project on view updates, release 2.2.1 - #3137
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the firestore-bigquery-change-tracker package to version 2.2.1. It fixes an issue where updating an existing _raw_latest view failed on plain Cloud Functions because the snapshot query builder dropped the bqProjectId parameter, causing it to fall back to process.env.PROJECT_ID (which is undefined outside of extensions). The fix explicitly passes bqProjectId: bq.projectId when initializing the latest view, and a corresponding unit test has been added to verify this behavior. There are no review comments, so I have no feedback to provide.
This was referenced Sep 7, 2026
cabljac
added a commit
that referenced
this pull request
Sep 8, 2026
First layer of the Cloud Tasks write buffer stack. Bumps firebase-admin from ^13.6.0 to ^14.2.0 and the change tracker from ^2.1.0 to ^2.2.1, regenerates the shrinkwrap, and adds one override; no source changes. The admin bump also moves `@google-cloud/firestore` from 7.11.6 to 8.7.1, a major on the client the tracker's backup writes go through. The next layers enqueue onto a task queue by bare function name. firebase-admin 14.2.0 resolves the deployed `kit-<instance id>-` prefix itself from `FIREBASE_KIT_INSTANCE_ID`, which the Firebase CLI sets on every deployed kit function from 15.28.0, so the kit does not have to reconstruct the prefix. Tracker 2.2.0 (#3133, #3134) is the first release that runs on firebase-admin 14: earlier versions pinned admin 13 and used the namespaced API, so npm nested a second admin copy under the tracker with no default app and every backup write failed. 2.2.1 (#3137) adds the view-update project fix from #3120. The shrinkwrap now holds a single `firebase-admin@14.3.0`, verified by resolving `firebase-admin/firestore` from the tracker's directory and calling `getFirestore` after the kit's `initializeApp`. The kit pins `firebase-functions ^7.3.3-rc.0`, which no stable range in the tracker can match, so a root `overrides` entry pins the tracker's firebase-functions to the kit's own; the shrinkwrap holds a single `firebase-functions@7.3.3-rc.0` as well, so tracker log lines keep the kit's trace context. That single-copy guarantee reaches consumers through the published shrinkwrap and holds for npm installs only: npm ignores `overrides` from a non-root package, and pnpm and yarn ignore a dependency's `npm-shrinkwrap.json`, so they resolve the tracker's `^6.3.2 || ^7.3.0` to a second firebase-functions copy. 62 unit tests and `tsc -b` pass on this layer; 89 on the top of the stack. The top of the stack was also deployed to a test project with Firebase CLI 15.29.0: `afterFirstDeploy` provisioned the dataset, changelog table, and view; create, update, and delete events landed in the changelog; a redeploy exercised the update-view path with the project preserved; and with the changelog table removed, the trigger enqueued onto `syncBigQuery`, the tracker wrote backup documents through admin 14 / firestore 8.7.1, and the queue drained without duplicate rows once the table was re-provisioned. Part of #3031.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of da21982 from #3121 (Corie's fix, approved by Izaak) onto
next, plus the 2.2.1 version bump and changelog entry. #3121 targetskits, but the tracker is published fromnext, so the fix never reached npm from there.The bug:
initializeLatestViewbuilds the snapshot query for an existing_raw_latestview withoutbqProjectId, sobuildLatestSnapshotViewQueryfalls back toprocess.env.PROJECT_ID. That variable is only set for extensions. On a kit the view query becameundefined.<dataset>.<table>and theinitBigQuerySynctask failed inafterFirstDeploy. The create path already passed the project. The fix passesbq.projectIdon the update path too, matching the create path.Tests: the materializedViews suites pass locally (20 tests), including the new one that sets
process.env.PROJECT_IDto a decoy and asserts the query uses the BigQuery project. Not verified against a live redeploy.After merge, dispatch
npm_publish_bq_scripts.ymlfor 2.2.1, then regenerate the kit shrinkwrap in the stack so the rc pins it.Fixes #3120