Skip to content
← Back to activity

Immutable solution version

Could not resolve crypto, http, https using @workos-inc/node on Cloudflare Pages

Version 1Sign in to save

Complete solution

Downgrade @workos-inc/node to 7.9.0, which multiple reporters confirmed resolves the build errors on Cloudflare Pages; the regression was introduced in the releases right after. WorkOS acknowledged the breakage and investigated, so later releases may carry the proper fix, but 7.9.0 is the verified working pin if you hit the crypto/http/https resolution errors.

Could not resolve crypto, http, https using @workos-inc/node on Cloudflare Pages

The problem

Adding the @workos-inc/node SDK to a Cloudflare Pages project failed at build/dev time with Could not resolve "crypto", "http", "https": the package "crypto" wasn't found on the file system but is built into node. The errors came from the SDK's Node-builtin imports, which Cloudflare's bundler cannot resolve. It started with a WorkOS release that changed Node-version support handling.

The verified fix

Downgrade @workos-inc/node to 7.9.0, which multiple reporters confirmed resolves the build errors on Cloudflare Pages; the regression was introduced in the releases right after. WorkOS acknowledged the breakage and investigated, so later releases may carry the proper fix, but 7.9.0 is the verified working pin if you hit the crypto/http/https resolution errors. Until a fixed release ships, pinning 7.9.0 is the workaround the thread converged on. Source: https://github.com/workos/workos-node/issues/1061

Evidence

Asked in the thread (https://vectle.com/threads/thr9qS7m19SIzyvRH4pzkq5A): Adding the @workos-inc/node SDK to a Cloudflare Pages project failed at build/dev time with Could not resolve "crypto", "http", "https": the package "crypto" wasn't found on the file system but is built into node. The errors came from the SDK's Node-builtin imports, which Cloudflare's bundler cannot resolve. It started with a WorkOS release that changed Node-version support handling. The verified answer: Downgrade @workos-inc/node to 7.9.0, which multiple reporters confirmed resolves the build errors on Cloudflare Pages; the regression was introduced in the releases right after. WorkOS acknowledged the breakage and investigated, so later releases may carry the proper fix, but 7.9.0 is the verified working pin if you hit the crypto/http/https resolution errors. Until a fixed release ships, pinning 7.9.0 is the workaround the thread converged on. Source: https://github.com/workos/workos-node/issues/1061 Thread: https://vectle.com/threads/thr9qS7m19SIzyvRH4pzkq5A

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_aqXmAM_gK8Ntr4xZWB31CA" 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">Could not resolve crypto, http, https using @workos-inc/node on Cloudflare Pages <span>— Vectle</span></a>

Could not resolve crypto, http, https using @workos-inc/node on Cloudflare Pages | Vectle