Skip to content

chore(demo_backend): upgrade indexing, admin and fetch dependencies - #955

Merged
fgatti675 merged 1 commit into
mainfrom
chore/demo-backend-dep-upgrades
Jul 31, 2026
Merged

chore(demo_backend): upgrade indexing, admin and fetch dependencies#955
fgatti675 merged 1 commit into
mainfrom
chore/demo-backend-dep-upgrades

Conversation

@fgatti675

Copy link
Copy Markdown
Member

Unblocks five dependabot PRs against demo_backend/functions that 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

PR Blocker Fix here
#938 algoliasearch 4→5 default export removed → TS2349: not callable named export + saveObject({indexName, body}) / deleteObject({indexName, objectID}); initIndex is gone in v5
#892 elasticsearch 8→9 TS2769, requests are flattened bodydocument on index(), query hoisted to top level of search()
#896 node-fetch 2→3 runtime break: v3 is ESM-only vs "module": "commonjs" + Node 20 → ERR_REQUIRE_ESM, and the import had a @ts-ignore so tsc stayed silent dropped node-fetch; uses Node 20's built-in fetch
#942 firebase-admin 13→14 ERESOLVE: firebase-functions@6.6.0 peer range excludes admin 14 firebase-functions → ^7.3.2 (first line accepting admin ^14), then admin → ^14.2.0; scripts migrated off the removed admin.firestore()/admin.credential namespaces
#937 firestore 7→8 was risky under admin 13 (^7.11.0 optional dep) now required: admin 14 declares @google-cloud/firestore: ^8.6.0, so 7 would be out of range

Notes

  • scripts/*.ts move to the modular firebase-admin/app / firebase-admin/firestore entry points already used under src/. Only admin.firestore(), admin.initializeApp and admin.credential were 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. The firebase-functions/v1 surface used here (region().pubsub.schedule().onRun, firestore.document().onWrite, EventContext, Change, DocumentSnapshot) is intact in v7 and was verified at runtime.

Verification

  • clean npm ci from the regenerated lockfile, no ERESOLVE
  • tsc --noEmit clean (33 pre-existing-on-upgrade errors resolved)
  • npm run build clean
  • runtime smoke test loading the compiled CJS output: confirms crypto.js no longer emits require("node-fetch"), algoliasearch v5 resolves under CJS with initIndex absent, elasticsearch v9 module loads, and firestore v8 still exposes v1.FirestoreAdminClient for backup.ts:40

🤖 Generated with Claude Code

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>
@fgatti675
fgatti675 merged commit 4cda968 into main Jul 31, 2026
2 checks passed
@fgatti675
fgatti675 deleted the chore/demo-backend-dep-upgrades branch July 31, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant