-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Labels
bugSomething isn't workingSomething isn't workingproviderstriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Description
Provider type
Environment
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M1
Memory: 450.28 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.17.1 - /opt/homebrew/opt/node@22/bin/node
npm: 10.9.2 - /opt/homebrew/opt/node@22/bin/npm
pnpm: 10.13.1 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 138.0.7204.158
Safari: 18.5
npmPackages:
next: 14.2.30 => 14.2.30
next-auth: ^4.24.11 => 4.24.11
react: ^18 => 18.3.1
Reproduction URL
https://github.com/palminha/next-auth-signin-exception
Describe the issue
I login with client signIn
and i want to return an error from sendVerificationRequest
, and for that i throw an exception.
The exception is not caugh and in the client the returned value is ok, 200, with error string EmailSignin
How to reproduce
- Run the example attached
- Go to http://localhost:3000
- Click in login
- See the result
{
"error":"EmailSignin",
"status":200,
"ok":true,
"url":null
}
- see the exception not caught in the server
next-auth][error][SIGNIN_EMAIL_ERROR]
https://next-auth.js.org/errors#signin_email_error Not a valid user {
error: {
message: 'Not a valid user',
stack: 'Error: Not a valid user\n' +
' at Object.sendVerificationRequest (webpack-internal:///(rsc)/./src/app/api/auth/[...nextauth]/route.ts:37:23)\n' +
' at email (webpack-internal:///(rsc)/./node_modules/next-auth/core/lib/email/signin.js:27:31)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
' at async Object.signin (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/signin.js:102:24)\n' +
' at async AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:221:26)\n' +
' at async NextAuthRouteHandler (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:57:28)\n' +
' at async NextAuth._args$ (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:89:16)\n' +
' at async /Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:57228\n' +
' at async eT.execute (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:46851)\n' +
' at async eT.handle (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:58760)\n' +
' at async doRender (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/base-server.js:1366:42)\n' +
' at async cacheEntry.responseCache.get.routeKind (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/base-server.js:1576:40)\n' +
' at async DevServer.renderToResponseWithComponentsImpl (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/base-server.js:1496:28)\n' +
' at async DevServer.renderPageComponent (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/base-server.js:1924:24)\n' +
' at async DevServer.renderToResponseImpl (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/base-server.js:1962:32)\n' +
' at async DevServer.pipeImpl (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/base-server.js:922:25)\n' +
' at async NextNodeServer.handleCatchallRenderRequest (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/next-server.js:272:17)\n' +
' at async DevServer.handleRequestImpl (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/base-server.js:818:17)\n' +
' at async /Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/dev/next-dev-server.js:339:20\n' +
' at async Span.traceAsyncFn (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/trace/trace.js:154:20)\n' +
' at async DevServer.handleRequest (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/dev/next-dev-server.js:336:24)\n' +
' at async invokeRender (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/lib/router-server.js:179:21)\n' +
' at async handleRequest (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/lib/router-server.js:359:24)\n' +
' at async requestHandlerImpl (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/lib/router-server.js:383:13)\n' +
' at async Server.requestListener (/Users/palmito/Development/next-auth-signin-exception/node_modules/next/dist/server/lib/start-server.js:141:13)',
name: 'Error'
},
providerId: 'email',
message: 'Not a valid user'
Expected behavior
- The exception is caught in the server
- The return object should be like this
{
"error":"The exception error message",
"status":500,
"ok":false,
"url":null
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingproviderstriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.