Skip to content

feat(algolia)!: migrate to algoliasearch v5 for CF Workers compat#69

Merged
JonasJesus42 merged 1 commit into
mainfrom
JonasJesus42/algolia-v5-migration
Jun 3, 2026
Merged

feat(algolia)!: migrate to algoliasearch v5 for CF Workers compat#69
JonasJesus42 merged 1 commit into
mainfrom
JonasJesus42/algolia-v5-migration

Conversation

@JonasJesus42

@JonasJesus42 JonasJesus42 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

v4 imports node:http and crypto at module load — crashes on CF Workers. v5 uses fetch + Web Crypto globally — runs everywhere. Breaks v4 call shape; granadobr-tanstack landing the loader updates alongside the bump.


Summary by cubic

Upgrade @decocms/apps/algolia to algoliasearch v5 to fix Cloudflare Workers crashes and run on runtimes that provide global fetch/Web Crypto. Removes the custom requester and introduces a breaking change to client.search.

  • Dependencies

    • Bump algoliasearch to ^5.53.0.
    • Remove @algolia/requester-fetch; peer dep now algoliasearch@^5.
  • Migration

    • Update search calls: v4 client.search([{ indexName, query, params: {...} }]) ➜ v5 client.search({ requests: [{ indexName, query, ...flatParams }] }).
    • Update imports: import { algoliasearch } from "algoliasearch" (no default export).
    • Remove requester: createFetchRequester(); v5 uses global fetch by default.

Written for commit 39fd8c9. Summary will update on new commits.

Review in cubic

v4 of the SDK + every `@algolia/*` sub-package imports either
`node:http` (`@algolia/requester-node-http`) or `crypto`
(`@algolia/client-search`) at module load time, which crashes on
Cloudflare Workers before any request is made. Passing
`createFetchRequester()` doesn't help because the import side-effect
fires first.

v5 uses the global `fetch` and Web Crypto APIs only — runs on
Workers, Bun, Deno, modern Node — so this also unblocks
granadobr-tanstack ProductShelves on the deployed worker.

BREAKING: sites consuming `@decocms/apps/algolia` must update their
loaders from the v4 `client.search([{ indexName, query, params:
{...} }])` shape to v5 `client.search({ requests: [{ indexName,
query, ...flatParams }] })`. Granadobr-tanstack will land the loader
update alongside the version bump.

Test mock updated to mirror v5's named export shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JonasJesus42 JonasJesus42 requested a review from a team June 3, 2026 02:20
@JonasJesus42 JonasJesus42 merged commit 218062c into main Jun 3, 2026
1 of 2 checks passed
@JonasJesus42 JonasJesus42 deleted the JonasJesus42/algolia-v5-migration branch June 3, 2026 02:23
JonasJesus42 added a commit that referenced this pull request Jun 3, 2026
PR #69 migrated algoliasearch to v5 but the squash commit's leading
"!" made semantic-release's angular preset skip the release. This
empty commit re-triggers the version bump so 2.8.0 lands on npm.

BREAKING CHANGE: client.search() signature changed from v4 array to
v5 { requests: [...] }. See PR #69 for full migration notes.
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant