Next.js Discord

Discord Forum

Nextjs app in standalone mode with Auth.js(v5) returns JWTSessionError

Answered
Champagne D’Argent posted this in #help-forum
Open in Discord
Champagne D’ArgentOP
hello. I'm getting this error:
2024-03-17 18:39:53 [auth][error] JWTSessionError: Read more at https://errors.authjs.dev#jwtsessionerror
2024-03-17 18:39:53 [auth][cause]: Error: no matching decryption secret
2024-03-17 18:39:53     at tI.clockTolerance (/app/.next/server/chunks/696.js:17:58648)
2024-03-17 18:39:53     at t_ (/app/.next/server/chunks/696.js:17:44016)
2024-03-17 18:39:53     at tk (/app/.next/server/chunks/696.js:17:45092)
2024-03-17 18:39:53     at tI (/app/.next/server/chunks/696.js:17:53016)
2024-03-17 18:39:53     at Object.tz [as decode] (/app/.next/server/chunks/696.js:17:58494)
2024-03-17 18:39:53     at iI (/app/.next/server/chunks/696.js:373:39347)
2024-03-17 18:39:53     at iW (/app/.next/server/chunks/696.js:373:45483)
2024-03-17 18:39:53     at async iq (/app/.next/server/chunks/696.js:373:49700)
2024-03-17 18:39:53     at async a (/app/.next/server/app/signin/page.js:1:4483)

and was wondering how I can resolve this.
I found this related thread https://github.com/nextauthjs/next-auth/discussions/6030 which suggests to
Check web server logs and tweak the config for proxy-body-size, proxy-buffer-size, fastcgi-buffer-size etc, in the case of Nginx and see if it helps.

but I don't use nginx and am just running the nextjs app in standalone mode. thanks
Answered by Ray
try starting the server with AUTH_SECRET=your secret node server.js and see if it works
View full answer

7 Replies

Answer
Champagne D’ArgentOP
holy crap. that worked. Thanks! how come it doesn't use my .env.local for that and/or how do i ensure that it does
Champagne D’ArgentOP
yes, I do. somehow copying .env.local as .env fixed it. it's a shame that this isn't documented. if anything, the docs make it seem as if only .env.local is really needed
Champagne D’ArgentOP
actually. false alarm. it's not working anymore
that is, it only works when I run AUTH_SECRET=your secret node server.js
Champagne D’ArgentOP
now I'm seeing a new error: InvalidCheck: PKCE code_verifier cookie was missing. .Read more at https://errors.authjs.dev#invalidcheck when running in standalone mode. I had to enable trustMode and comment out the export const runtime = "edge"; comment included in the project