Need Help - Remix + Vite (Cloudflare Pages)

I migrated my remix application from a nodejs based template to the cloudflare template. On trying to deploy my application on Cloudflare pages, I encounter errors that make the build process fail. The main problem is that I have packages that rely on some node internals and even after turning on the nodejs_compat option for the project, the errors still show up. I have attached a downloaded log to help.
4 Replies
Mike Oristian
Mike Oristian9mo ago
having this same problem - Drizzle pg libraries can't rely on node internals.
jogo-list-by-toy
the same,i think pages is not very compatible to fullstack app
Elliot Hesp
Elliot Hesp9mo ago
Not all node internals are supported. You'll need to use packages which don't rely on those. For example the pg package, you'd need to use a http/ws driver instead
Jay
Jay9mo ago
I am also running into this issue...'stream' and 'crypto' are required somehow in node.js packages and I can't access the original files.
[ERROR] Could not resolve "crypto"
14:19:14.295
14:19:14.295 ../../node_modules/.pnpm/[email protected]/node_modules/cookie-signature/index.js:5:21:
14:19:14.295 5 │ var crypto = require('crypto');
14:19:14.295 ╵ ~~~~~~~~
14:19:14.296
14:19:14.296 The package "crypto" wasn't found on the file system but is built into node.
14:19:14.296 Add the "nodejs_compat" compatibility flag to your Pages project and make sure to prefix the module name with "node:" to enable Node.js compatibility.
14:19:14.296
14:19:14.296
14:19:14.296 ✘ [ERROR] Could not resolve "stream"
14:19:14.296
14:19:14.296 ../../node_modules/.pnpm/[email protected]/node_modules/stream-slice/index.js:3:24:
14:19:14.296 3 │ var Transform = require('stream').Transform;
[ERROR] Could not resolve "crypto"
14:19:14.295
14:19:14.295 ../../node_modules/.pnpm/[email protected]/node_modules/cookie-signature/index.js:5:21:
14:19:14.295 5 │ var crypto = require('crypto');
14:19:14.295 ╵ ~~~~~~~~
14:19:14.296
14:19:14.296 The package "crypto" wasn't found on the file system but is built into node.
14:19:14.296 Add the "nodejs_compat" compatibility flag to your Pages project and make sure to prefix the module name with "node:" to enable Node.js compatibility.
14:19:14.296
14:19:14.296
14:19:14.296 ✘ [ERROR] Could not resolve "stream"
14:19:14.296
14:19:14.296 ../../node_modules/.pnpm/[email protected]/node_modules/stream-slice/index.js:3:24:
14:19:14.296 3 │ var Transform = require('stream').Transform;
Ah...fixed it. Instead of using @remix-run/node you have to switch to @remix-run/cloudflare.
Want results from more Discord servers?
Add your server