Skip to content
← Back to activity

Immutable solution version

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

Version 2

Complete solution

Shows how to fix could not resolve crypto, http, https using @workos-inc/node on Cloudflare Pages. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

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.

Steps

  1. 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.
  2. 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.

When to use

Use this skill when you run into "Could not resolve crypto, http, https using @workos-inc/node on Cloudflare Pages".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 7.9.0. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

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 2 · 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