Next.js Discord

Discord Forum

Opting out of the middleware constraints

Unanswered
Cornish Rex posted this in #help-forum
Open in Discord
Cornish RexOP
Hey, community. Can I generally opt out of the middleware constraints when building my app (Next.js 13.5.6)?
Why do I want to do this? I self-hosted my Next.js app, so the middleware is not deploying on the Edge.
What did I do before posting this? I found about the unstable_allowDynamic middleware config key in the [docs](https://nextjs.org/docs/pages/api-reference/edge#unsupported-apis). I didn't make it work, though. It may be related to my app using pnpm workspaces, and I keep getting this error.
Failed to compile.
../../node_modules/.pnpm/node-machine-id@1.1.12/node_modules/node-machine-id/dist/index.js
Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime 
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

Import trace for requested module:
../../node_modules/.pnpm/node-machine-id@1.1.12/node_modules/node-machine-id/dist/index.js
../../packages/utils/dist/chunk-XIF2ISXK.js
../../packages/utils/dist/index.js
./src/middleware.ts

0 Replies