Next.js Discord

Discord Forum

NextAuth Errors

evro posted this in #help-forum
Open in Discord
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.

Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime 
Learn More:

Import trace for requested module:

> 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 ( 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

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.