Closed
Description
Environment
System:
OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700KF
Memory: 12.22 GB / 15.53 GB
Container: Yes
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/.asdf/installs/nodejs/16.18.0/bin/node
Yarn: 1.22.19 - ~/.asdf/installs/nodejs/16.18.0/bin/yarn
npm: 8.19.2 - ~/.asdf/plugins/nodejs/shims/npm
npmPackages:
next: 13.0.6 => 13.0.6
next-auth: 4.18.5 => 4.18.5
react: 18.2.0 => 18.2.0
Reproduction URL
https://github.com/nextauthjs/next-auth-example
Describe the issue
npm run build
starts failing to build after upgrading next-auth to v4.18.5 if the project uses next-auth/middleware
.
Even the official example repository next-auth-example cannot be built with the latest version of next-auth.
$ npm run build
> build
> next build
info - Linting and checking validity of types
info - Creating an optimized production build
Failed to compile.
./node_modules/@babel/runtime/regenerator/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/@babel/runtime/regenerator/index.js
./node_modules/next-auth/core/errors.js
./node_modules/next-auth/utils/web.js
./node_modules/next-auth/next/middleware.js
./node_modules/next-auth/middleware.js
How to reproduce
$ git clone https://github.com/nextauthjs/next-auth-example
$ cd next-auth-example
$ npm install
$ npm run build
Expected behavior
npm run build
is done without any errors.