I’m running into a frustrating issue with the Code node. I’m using n8n Runners on Node v22 and I’ve already configured my environment variables to allow all built-ins and external modules:
NODE_FUNCTION_ALLOW_BUILTIN=*
NODE_FUNCTION_ALLOW_EXTERNAL=*
The overrides are working because I can now load other modules that were previously blocked, but fetch still throws ERROR: fetch is not a function.
Is this blocked as per the sandboxed env, if yes, how do I unblock it?
NODE_FUNCTION_ALLOW_BUILTIN=* and NODE_FUNCTION_ALLOW_EXTERNAL=* only affect what you can require() in the Code Node. They dont make node’s global fetch available inside n8n’s sandbox, so fetch may still be missing even on Node v22.
Maybe you can try use the HTTP Request node, or you can use an allowed HTTP library inside Code (like axios/node-fetch) via require().
Hello Fahmi, and thank you for your reply . The solution for me is to provide a way to lift these restrictions. I know there are workarounds, but that’s not ideal. There is no clear documentation of what’s available and what’s not in Code Node, that’s the main problem.
Anyway, I’m working on implementing my own external runner for such tasks that require running code without being restricted.