Vercel Edge "Dynamic Code Evaluation ... not allowed" in CI
The Edge runtime runs on V8 isolates that disallow eval, new Function, and WebAssembly.compile from a string. When your code or a dependency evaluates code at runtime, the build or request fails.
What this error means
The build or an edge request fails with "Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime", naming the module that uses it.
Error: Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile')
not allowed in Edge Runtime
Used by default in node_modules/some-template-engine/index.jsCommon causes
A dependency compiles code at runtime
Template engines, schema validators, and serializers sometimes build a function from a string with new Function, which the Edge runtime blocks.
Direct use of eval in edge code
Application code calls eval or new Function directly inside a route or middleware that runs on the Edge runtime.
How to fix it
Move the route off the Edge runtime
If the dependency genuinely needs dynamic evaluation, run that route on the Node runtime where eval is allowed.
// run on Node instead of Edge
export const runtime = 'nodejs';Replace the dependency that evaluates code
- Read the build error to see which module uses eval or new Function.
- Swap it for an edge-compatible alternative that precompiles ahead of time.
- Remove any direct eval in your own edge code.
How to prevent it
- Choose edge-compatible libraries that do not evaluate code at runtime.
- Keep eval and new Function out of edge routes and middleware.
- Test edge routes against the Edge runtime locally before deploying.