Configuration file for Pages projects does not support "node_compat"

20:24:18.122 ✘ [ERROR] Running configuration file validation for Pages:
20:24:18.122
20:24:18.123 - Configuration file for Pages projects does not support "node_compat"
20:24:18.122 ✘ [ERROR] Running configuration file validation for Pages:
20:24:18.122
20:24:18.123 - Configuration file for Pages projects does not support "node_compat"
I'm having some compatability issues, where my code works on Workers but not on Pages Functions.
54 Replies
Vero
Vero4mo ago
Hey. Pages doesn't support node_compat, but it does support nodejs_compat, which is slightly different
jjjrmy
jjjrmy4mo ago
@Vero 🐙 will this help? https://x.com/jasnell/status/1795872787594358875 or it is only for Workers (not Pages Functions)
James M Snell (@jasnell) on X
A @Cloudflare Workers Node.js compatibility update... we will soon be enabling a revised version of the nodejs_compat flag (called nodejs_compat_v2) that makes a couple of key improvements to the implementation...
Twitter
Walshy
Walshy4mo ago
functions are workers so it's available for them too but if it will help depends on your needs and what packages you require
jjjrmy
jjjrmy4mo ago
knex is the package. and if they were the same thing, or functioned in the same way then node_compat flag would work the same as nodejs_compat but they do not.
Walshy
Walshy4mo ago
Being the same doesn't mean the support is the same (long story) Product explicitly decided to not support node_compat due to it being our not recommended thing
jjjrmy
jjjrmy4mo ago
so then what is the solution? where this library works on Workers but not on Pages?
jjjrmy
jjjrmy3mo ago
GitHub
GitHub - jjjrmy/hono-sutando-cf-worker-pages
Contribute to jjjrmy/hono-sutando-cf-worker-pages development by creating an account on GitHub.
Walshy
Walshy3mo ago
?
jjjrmy
jjjrmy3mo ago
was just responding with a reproduciton repo - so maybe someone on the Workers/Pages team can get to the bottom of it
Walshy
Walshy3mo ago
Again, not supporting node_compat was an explicit decision, it was not done intentionally. It isn't a bug.
jjjrmy
jjjrmy3mo ago
so then what do you do in a case like this? just not use Cloudflare?
Walshy
Walshy3mo ago
Find an alternative library that does support edge runtimes.
jjjrmy
jjjrmy3mo ago
if everything points to using Cloudflare Pages over Workers, but Pages doesn't support the same libraries read the deploy log - it seems like it's a different limitation than the library itself Error: Failed to publish your Function. Got error: Uncaught Error: Dynamic require of "events" is not supported
Walshy
Walshy3mo ago
you or a library is doing a dynamic require('events'). This isn't supported by esbuild (the Workers/Pages bundler that Wrangler uses).
jjjrmy
jjjrmy3mo ago
then how is it working on Workers?
Want results from more Discord servers?
Add your server