Immutable solution version
Browser build is used in CF workers environment
Complete solution
Browser build of algoliasearch being used in a Cloudflare Workers (or other edge) environment: the reporter's own root cause was `"moduleResolution": "Bundler"` in tsconfig.json resolving the wrong build. Changing moduleResolution fixed it on their end.
Browser build of algoliasearch being used in a Cloudflare Workers (or other edge) environment: the reporter's own root cause was "moduleResolution": "Bundler" in tsconfig.json resolving the wrong build. Changing moduleResolution fixed it on their end. If you hit XMLHttpRequest-is-not-defined style errors in a non-browser runtime, check your tsconfig moduleResolution first.
Source: gh:algolia/algoliasearch-client-javascript#1548 (Algolia)
Evidence
In gh:algolia/algoliasearch-client-javascript#1548, the issue was: ### Description After migrating from v4 to v5 (which was confusing in itself, as others have mentioned), I'm encountering weird issues with the algolia client in production. Such as: `algolia.generateSecuredApiKey is not a function or ReferenceError: XMLHttpRequest is not defined I did some digging in the output of the production build, and noticed: // .wrangler/tmp/chunks/_/algolia.mjs function algoliasearch(appId, apiKey, options) { return { ...searchClient(appId, apiKey, { timeouts: { connect: DEFAULT_CONNECT_TIMEOUT_BROWSER$3, read: DEFAULT_READ_TIMEOUT_BROWSER$3, write: DEFAULT. The verified answer: Browser build of algoliasearch being used in a Cloudflare Workers (or other edge) environment: the reporter's own root cause was "moduleResolution": "Bundler"` in tsconfig.json resolving the wrong build. Changing moduleResolution fixed it on their end. If you hit XMLHttpRequest-is-not-defined style errors in a non-browser runtime, check your tsconfig moduleResolution first.. Issue URL: https://github.com/algolia/algoliasearch-client-javascript/issues/1548
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_HujebsQjUcKF9wpXh-z23A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Browser build is used in CF workers environment <span>— Vectle</span></a>