Repository navigation
fix(cloudflare): detect implicit nodejs_compat when deployConfig is false - #4667
Conversation
…alse Closes nitrojs#4649 Infer Node.js compatibility when compatibility_date is on or after NODEJS_COMPAT_DEFAULT_ON_DATE (2026-08-04) and no negative compatibility flag (no_nodejs_compat or no_nodejs_compat_v2) is present, even when deployConfig is false and no explicit nodejs_compat flag is set.
|
@agustin18 is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…implicit-node-compat-4649 # Conflicts: # src/presets/cloudflare/utils.ts
`no_nodejs_compat_v2` only disables the v2 extras; `nodejs_compat` (v1) is still on by default from 2026-08-04. Nitro v2 adds this flag itself, so it must not disable nodeCompat inference.
🔗 Linked issue
Closes #4649
❓ Type of change
📚 Description
Cloudflare enables Node.js compatibility by default for compatibility dates on or after
2026-08-04.When
cloudflare.deployConfigis set tofalseand the user's Wrangler config does not contain an explicitnodejs_compatflag (following Cloudflare's guidance where the explicit flag is redundant for modern dates),enableNodeCompat()failed to infer that Node.js compatibility was active. As a result, Nitro omitted the hybrid node compat plugin and unenv node compat configuration, falling back to stubbed implementations that throw at runtime (e.g.[unenv] crypto.createHash is not implemented yet!).This fix:
isDefaultNodeCompat) when the resolved compatibility date is on or afterNODEJS_COMPAT_DEFAULT_ON_DATE(2026-08-04), provided no negative flags (no_nodejs_compat,no_nodejs_compat_v2) are specified.nitro.options.compatibilityDate.test/unit/cloudflare.utils.test.tscovering implicit detection, explicit negative flags,wrangler.tomlparsing, anddeployConfigstates.📝 Checklist