1

I've been working on a site with Next.js using next-auth and Prisma. Everything was working fine, however today the code doesn't work anymore. I just getting this error from any pages under [...nextauth].js

Server Error
SyntaxError: Unexpected token 'export'

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
<unknown>
/Users/user/wwww/node_modules/ (next-auth/prisma-adapter/dist/index.js (1)
wrapSafe
internal/modules/cjs/loader.js (1001:16)
Module._compile
internal/modules/cjs/loader.js (1049:27)
Object.Module._extensions..js
internal/modules/cjs/loader.js (1114:10)
Module.load
internal/modules/cjs/loader.js (950:32)
Function.Module._load
internal/modules/cjs/loader.js (790:14)
Module.require
internal/modules/cjs/loader.js (974:19)
require
internal/modules/cjs/helpers.js (92:18)
Object.@next-auth/prisma-adapter
file:///Users/user/wwww/.next/server/pages/api/auth/[...nextauth].js (22:18)
__webpack_require__
file:///Users/user/wwww/.next/server/webpack-api-runtime.js (33:42)
eval
webpack-internal:///(api)/./src/pages/api/auth/[...nextauth].js (11:83)

Nothing was changed that would justify this (last changes were on html level) except for a small library update (prisma from 3.8.1 to 3.11.0 and next-auth from 4.2.1 to 4.3.0). I tried to revert to those versions but the error is still there.

1
  • Could you show your code for [...nextauth].js? Commented Mar 17, 2022 at 1:00

1 Answer 1

2

This issue is caused by a recent release of next-auth. The only option is to downgrade as of now as mentioned in this GitHub Issue.

This was caused by changing the outputs to ESM.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.