T
TanStack4w ago
narrow-beige

Server dependency leaking to client?

I have a starter template that worked before: https://github.com/winstonpurnomo/turborepo-starter-v2, but now suddenly doesn't - when I try to load the index page, I get an error: hook.js:608 Module "crypto" has been externalized for browser compatibility. Cannot access "crypto.getCiphers" in client code. This stems from the @workos-inc/node package, which I only use in server functions. Does anyone have an explanation for if there is a proper way to protect a server-only dependency from seemingly leaking to client?
3 Replies
dependent-tan
dependent-tan4w ago
Try adding this to vite config ssr: { external: ["@workos-inc/node"], },
narrow-beige
narrow-beigeOP4w ago
nope, it didn't work, still having the same error
manual-pink
manual-pink3w ago
Ha - I just ran into this issue as well. Did you ever find a workaround?

Did you find this page helpful?