Next.js Discord

Discord Forum

NextAuth Errors

Unanswered
evro posted this in #help-forum
Open in Discord
Avatar
evroOP
Receiving err:
(base) ➜  frontend git:(tests) ✗ npm run build

> OptimaFlo@0.0.0 build
> next build

- info Loaded env from /.../frontend/.env.local
- info Loaded env from /.../frontend/.env
- warn You have enabled experimental features (turbo, serverComponentsExternalPackages) in next.config.js.
- warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

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/client/_utils.js
./node_modules/next-auth/react/index.js


> Build failed because of webpack errors
- info Creating an optimized production build .%


This is a bug with nextAuth when I run
npm run build
.

I've tried changing package versions on both nextAuth and next but getting various errors as well. Tried following this thread on github (https://github.com/nextauthjs/next-auth/discussions/5855) with no luck (getting errors for crypto modules that are managed in the node package - i.e. no control over code).

My assumption is that this is strictly a nextAuth issue but wanted to ask the next community and verify. Has anyone had this issue?

1 Reply

Avatar
evroOP
For now, I've added
  unstable_allowDynamic: [
    '/node_modules/@babel/runtime/regenerator/index.js', // relax the check 
  ],
to my middleware. Waiting for updates from next-auth and maybe prisma.