chore(demo_backend): upgrade indexing, admin and fetch dependencies - #955
Merged
Conversation
Unblocks the dependabot bumps that could not land as-is because the new
major versions break the existing code.
- algoliasearch 4 -> 5: `algoliasearch` is now a named export and the
per-index handle is gone, so `initIndex(...).saveObject/deleteObject`
become `client.saveObject({ indexName, body })` and
`client.deleteObject({ indexName, objectID })`.
- @elastic/elasticsearch 8 -> 9: requests are flattened, so `body` is
replaced by `document` on `index()` and the query moves to the top
level of `search()`. The `index()` call only type-checked before
because the payload was `any`.
- node-fetch dropped entirely in favour of the fetch built into Node 20.
node-fetch 3 is ESM-only, so bumping it would have made the compiled
`require("node-fetch")` throw ERR_REQUIRE_ESM at runtime under
`"module": "commonjs"` — and the import carried a `@ts-ignore`, so
nothing would have flagged it at build time.
- firebase-admin 13 -> 14, which needs firebase-functions >= 7.3 to
satisfy its peer range. Admin 14 removes the namespaced
`admin.firestore()` / `admin.credential`, so the scripts move to the
modular `firebase-admin/app` and `firebase-admin/firestore` entry
points already used under src/. The dropped
`settings({ timestampsInSnapshots: true })` has been a no-op since
Firestore 1.0 removed the flag.
- @google-cloud/firestore 7 -> 8, now required rather than optional:
firebase-admin 14 declares it as `^8.6.0`, so staying on 7 would have
left admin running against a client outside its declared range.
Verified with a clean `npm ci`, `tsc --noEmit` and `npm run build`, plus
a runtime smoke test that loads the compiled CJS output and confirms
crypto.js no longer requires node-fetch and firestore v8 still exposes
`v1.FirestoreAdminClient` for backup.ts.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Unblocks five dependabot PRs against
demo_backend/functionsthat could not merge as-is because the target major versions break the existing code. Supersedes #938, #892, #896, #942 and #937.Why each was blocked
TS2349: not callablesaveObject({indexName, body})/deleteObject({indexName, objectID});initIndexis gone in v5TS2769, requests are flattenedbody→documentonindex(), query hoisted to top level ofsearch()"module": "commonjs"+ Node 20 →ERR_REQUIRE_ESM, and the import had a@ts-ignoreso tsc stayed silentfetchERESOLVE:firebase-functions@6.6.0peer range excludes admin 14^7.3.2(first line accepting admin^14), then admin →^14.2.0; scripts migrated off the removedadmin.firestore()/admin.credentialnamespaces^7.11.0optional dep)@google-cloud/firestore: ^8.6.0, so 7 would be out of rangeNotes
scripts/*.tsmove to the modularfirebase-admin/app/firebase-admin/firestoreentry points already used undersrc/. Onlyadmin.firestore(),admin.initializeAppandadmin.credentialwere in use.settings({ timestampsInSnapshots: true })was dropped — the flag was removed when Firestore 1.0 made Timestamps the default, so it was already a no-op and no longer typechecks.functions.config()appears only inside a comment, so nothing live depended on the API removed in firebase-functions 7. Thefirebase-functions/v1surface used here (region().pubsub.schedule().onRun,firestore.document().onWrite,EventContext,Change,DocumentSnapshot) is intact in v7 and was verified at runtime.Verification
npm cifrom the regenerated lockfile, noERESOLVEtsc --noEmitclean (33 pre-existing-on-upgrade errors resolved)npm run buildcleancrypto.jsno longer emitsrequire("node-fetch"), algoliasearch v5 resolves under CJS withinitIndexabsent, elasticsearch v9 module loads, and firestore v8 still exposesv1.FirestoreAdminClientforbackup.ts:40🤖 Generated with Claude Code