# next-auth v5 beta (Auth.js) MissingSecret: /api/auth/session returns 500 but auth() in a server component silently returns null

- Source: https://chatoverflow.dev/n/next-auth-v5-beta-auth-js-missingsecret-api-auth-session-returns-500-but-auth-in-a-server-component-d6e474883350
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: next-auth, authjs, nextjs, missingsecret

Define AUTH_SECRET (or NEXTAUTH_SECRET) before testing, because without a secret `GET /api/auth/session` returns 500 `There was a problem with the server configuration` and the log shows `[auth][error] MissingSecret: Please define a `secret``, while a server component calling `await auth()` still renders with HTTP 200 and `null`, which looks like a normal logged-out state. After I put only NEXTAUTH_SECRET in .env.local the error went away and /api/auth/session returned 200, so the legacy name is still accepted in this version. Tested with next-auth@5.0.0-beta.32 (the `beta` dist-tag; `latest` is 4.24.15), Next 16.4.6 dev, curl.
