nextauthjs / nextauthjs/next-auth
signIn server action fails with Configuration error on Next.js 16
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Environment
System:
OS: Windows 11 10.0.26200
CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
Binaries:
Node: 24.11.1
npm: 11.6.2
npmPackages:
next: 16.1.6
next-auth: 5.0.0-beta.30
react: 19.2.3
Reproduction URL
https://github.com/TaylorBurke/nextauth-nextjs16-repro
Describe the issue
The signIn server action exported from NextAuth() fails with a Configuration error on Next.js 16. The HTTP handler (handlers.GET/handlers.POST) works correctly for the same request.
The reproduction is a minimal Next.js 16 app with a single GitHub OAuth provider:
// src/lib/auth.ts
import NextAuth from 'next-auth'
import GitHub from 'next-auth/providers/github'
export const { handlers, auth, signIn, signOut } = NextAuth({
basePath: '/api/auth',
providers: [GitHub],
})
The login page uses the documented server action pattern:
import { signIn } from '@/lib/auth'
<form action={async () => {
'use server'
await signIn('github', { redirectTo: '/' })
}}>
<button type="submit">Sign in with GitHub</button>
</form>
Clicking the button redirects to the error page with ?error=Configuration instead of redirecting to GitHub OAuth.
What works:
GET /api/auth/csrf— returns CSRF tokenGET /api/auth/providers— returns providersGET /api/auth/session— returns nullGET /api/auth/signin— renders built-in signin page (which uses direct form POST, not server actions)POST /api/auth/signin/githubvia curl with proper CSRF cookie — returns 302 to GitHub OAuth- Calling
Auth()directly with a manually constructed request — works
The issue is specifically in the signIn server action in next-auth/lib/actions.js, which constructs a synthetic request via createActionURL() and passes it to Auth(). Something in this request construction fails on Next.js 16. The error is caught in Auth() and converted to the generic Configuration type before redirecting.
The bug reproduces both on localhost (HTTP) and on Vercel (HTTPS).
Workaround: Use direct HTML form POST (the same pattern the built-in signin page at /api/auth/signin uses) with a client component that fetches the CSRF token browser-side.
How to reproduce
- Clone the reproduction repo
- Copy
.env.exampleto.env.localand fill in GitHub OAuth credentials + a secret npm install && npm run dev- Visit
http://localhost:3000 - Click "Sign in with GitHub (server action)"
- Observe redirect to
/api/auth/error?error=Configuration
For comparison, visit /api/auth/signin to see the built-in signin page — clicking "Sign in with GitHub" there works correctly because it uses direct form POST, not the server action.
Expected behavior
Clicking the server action sign-in button should redirect to GitHub's OAuth authorization page, the same way the built-in signin page and direct HTTP POST do.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked minimal reproduction with the listed GitHub OAuth setup, then inspect next-auth/lib/actions.js, especially the signIn server action and its createActionURL() request construction. Compare that synthetic request with the working direct HTTP POST and Auth() calls. Done means the server action redirects to GitHub OAuth instead of /api/auth/error?error=Configuration on Next.js 16.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, react, typescript
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100