chore(firestore-bigquery-export): bump firebase-admin to ^14.2.0 - #3127
chore(firestore-bigquery-export): bump firebase-admin to ^14.2.0#3127cabljac wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the firebase-admin dependency from ^13.6.0 to ^14.2.0 in kits/firestore-bigquery-export/package.json and updates the lockfile accordingly. However, this upgrade introduces a dual-instance hazard because @firebaseextensions/firestore-bigquery-change-tracker still depends on v13. This mismatch can lead to runtime errors since the nested v13 instance used by the change tracker will remain uninitialized. To resolve this, the change tracker should be updated to support v14, or the initialized Firebase instance should be passed directly to the tracker.
…ase-admin 14 (#3133) The change tracker pins `firebase-admin` to `^13.2.0`. A consumer on firebase-admin 14 therefore installs a second copy of the SDK nested under the tracker, and that copy has its own app registry: the consumer's `initializeApp()` never reaches it. Every call the tracker makes through its own copy, which today is the backup write in `handleFailedTransactions`, fails with "The default Firebase app does not exist", the failure is logged as `failedBackupWrite`, and the rows meant for `backupTableId` are lost. Verified by loading both copies in one process against the published 2.1.0. The range was already widened to `^13.2.0 || ^14.0.0` on the `kits` branch (cc86630) but that landed at 2.0.4 and was never published; 2.1.0 was cut from `next` without it. This cherry-picks that commit onto `next` and releases it as 2.1.1 with a changelog entry. No source changes: the tracker only uses `getFirestore`, `firebase-admin/app` and `Timestamp`, all unchanged between 13 and 14, and the firebase-functions 6 it depends on already accepts admin 14. `npm ci` and `npm run build` pass. The jest suite needs live BigQuery and was not run. Unblocks the kit bump in #3127. --------- Co-authored-by: Izaak Gough <izaak.gough@invertase.io>
…ase-admin 14 (#3134) Follow-up to #3133. 2.1.1 widened the firebase-admin range to `^13.2.0 || ^14.0.0` but two things stopped it working on 14. First, firebase-admin 14 removes the namespaced API. The package still read `admin.apps` at import in `handleFailedTransactions` and `admin.firestore.Timestamp` in the partition converter, so wherever it resolved against admin 14 it threw `Cannot read properties of undefined (reading 'length')` at import. Every namespaced use, in shipped code, the test fixture and the tests, is now the modular API from `firebase-admin/app` and `firebase-admin/firestore`, which is identical on 13 and 14. Second, the package depends on firebase-functions `^6.3.2`, whose peer range for firebase-admin stops at `^13.0.0`. On a consumer running admin 14 npm therefore kept a nested admin 13 under the tracker regardless of the tracker's own range, and that nested copy has no default app. Under npm that nesting is also why 2.1.1 did not crash: `admin.apps` resolved on the nested 13. The range now accepts firebase-functions 7 as well; the package only uses its `logger`. Verified: build and the test tsconfig compile against admin 14.3.0 and functions 7.3.2; `converter.test.ts` passes (48) on that tree; the packed tarball installed into the firestore-bigquery-export kit on admin 14, followed by `npm dedupe`, collapses to a single admin copy, the tracker resolves the kit's app, and all 62 kit tests pass. An existing consumer shrinkwrap does not dedupe on its own, since the nested 13 still satisfies the new ranges, so the kit bump must dedupe explicitly. The kit pins firebase-functions `^7.3.3-rc.0`, which no stable range matches, so a nested firebase-functions 7.3.2 remains under the tracker until the kit moves to a stable 7.x; that only affects trace correlation on tracker log lines, not the admin app. The lockfile stays on admin 13 and functions 6 because under admin 14 the jest config cannot load the ESM-only `jose` that firebase-functions v2 pulls in via admin auth; that is a jest `transformIgnorePatterns` gap for a separate change. The live BigQuery suites were not run. Unblocks the kit bump in #3127.
957a4ce to
aed3029
Compare
793eefb to
28a56be
Compare
IzaakGough
left a comment
There was a problem hiding this comment.
Approving. Checked the shrinkwrap holds single copies of firebase-admin@14.3.0 and firebase-functions@7.3.3-rc.0 with no nested tracker copies, and confirmed the override is genuinely required: tracker 2.2.1 declares firebase-functions: "^6.3.2 || ^7.3.0", which a prerelease 7.3.3-rc.0 cannot satisfy under semver. Also confirmed npm does not record overrides in the lockfile, so its absence from the shrinkwrap root entry is expected rather than a stale lock.
The motivating behaviour is real: firebase-admin/lib/functions/functions.js reads FIREBASE_KIT_INSTANCE_ID in the task queue scope resolution. And the kit source only imports firebase-admin/app and firebase-admin/eventarc, both stable across the v14 major, so "no source changes" holds.
Three notes inline, none blocking.
28a56be to
793eefb
Compare
firebase-admin 14.2.0 resolves the deployed kit function name prefix from FIREBASE_KIT_INSTANCE_ID when enqueuing onto a task queue. The change tracker moves to 2.2.0, the first release that runs on firebase-admin 14, so the shrinkwrap holds a single admin copy and the tracker sees the kit's app. An override pins the tracker's firebase-functions to the kit's own prerelease, which no stable range can match, so the shrinkwrap holds a single firebase-functions copy too.
793eefb to
6bba3bf
Compare
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/firestorefrom 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 fromFIREBASE_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 resolvingfirebase-admin/firestorefrom the tracker's directory and callinggetFirestoreafter the kit'sinitializeApp. The kit pinsfirebase-functions ^7.3.3-rc.0, which no stable range in the tracker can match, so a rootoverridesentry pins the tracker's firebase-functions to the kit's own; the shrinkwrap holds a singlefirebase-functions@7.3.3-rc.0as 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 ignoresoverridesfrom a non-root package, and pnpm and yarn ignore a dependency'snpm-shrinkwrap.json, so they resolve the tracker's^6.3.2 || ^7.3.0to a second firebase-functions copy.62 unit tests and
tsc -bpass 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:afterFirstDeployprovisioned 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 ontosyncBigQuery, 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.