workos/workos-node

Library does not work with NextJS 15 RC + Turbopack

f1shy-dev opened this issue · 1 comments

Trying to use workos-node (from nextjs-authkit) causes these errors:

 ⨯ Error: Cannot find module 'node:http': Unsupported external type Url for commonjs reference
 Error: Cannot find module 'node:crypto': Unsupported external type Url for commonjs reference

I was able to fix it locally by commenting these out these lines from node_modules/@workos-inc/node/lib/index.js

18 // const node_crypto_provider_1 = require("./common/crypto/node-crypto-provider");
21 // const node_client_1 = require("./common/net/node-client");

45        // else {
46        //     return new node_client_1.NodeHttpClient(this.baseURL, opts);
47        // }

55         // else {
56        //     cryptoProvider = new node_crypto_provider_1.NodeCryptoProvider();
57        // }

However, could we please get a proper fix for this? (I would open a PR, however I am not entirely sure what the proper way would be to fix this. Possibly a dynamic import?)

Thanks for the report, judging by vercel/next.js#66808 it looks like we need to provide a edge-lite export for Next 15 environments.