Pages Function Fails: "Dynamic require" Error Despite nodejs_compat Flag

My Cloudflare Pages Function, which uses an Express server, is failing at runtime with the error: Uncaught Error: Dynamic require of "node:events" is not supported. We have already taken the following troubleshooting steps: Confirmed the nodejs_compat flag is in our wrangler.toml. Confirmed the nodejs_compat flag is set correctly in the Pages project settings UI for both Production and Preview. Completely deleted and recreated the Pages project from scratch, setting the flag during the initial setup wizard. Despite these steps, the runtime environment is still not applying the compatibility flag. Please advise.
1 Reply
SuperHelpflare
SuperHelpflare•3mo ago
Please do not post your question in multiple channels/post it multiple times per the rules at #😃welcome-and-rules. It creates confusion for people trying to help you and doesn't get your issue or question solved any faster.

Did you find this page helpful?