Next.js Discord

Discord Forum

Cannot logout of my session

Unanswered
Frank posted this in #help-forum
Open in Discord
Avatar
I am trying out Next-Auth with magic links, Resend, using Turso, and Drizzle ORM. The first time I attempted to sign in, Resend yelled at me because I used the email I used to set up Resend... but apparently now const session = auth(); comes back true because it's showing me the logged in state [on my main page.tsx](https://github.com/frankstallone/test-next-app/blob/main/app/page.tsx#L10). I went off a few guides but none talked about signing out, really. Here's my [signout action](https://github.com/frankstallone/test-next-app/blob/main/actions/signout.ts) and when I try and sign out, the page refreshes and I get this in Terminal:


Failed to sign out Error: NEXT_REDIRECT
    at getRedirectError (../../../src/client/components/redirect.ts:20:16)
    at getRedirectError (../../../src/client/components/redirect.ts:45:8)
    at async handleSignOut (actions/signout.ts:12:4)
    at async (webpack://next/dist/src/server/app-render/action-handler.ts:881:24)
    at async handleAction (webpack://next/dist/src/server/app-render/action-handler.ts:617:4)
    at async renderToHTMLOrFlightImpl (webpack://next/dist/src/server/app-render/app-render.tsx:1310:34)
    at async doRender (node_modules/next/src/server/base-server.ts:2666:21)
    at async responseGenerator (node_modules/next/src/server/base-server.ts:3027:21)
    at async DevServer.renderToResponseWithComponentsImpl (node_modules/next/src/server/base-server.ts:3039:23)
    at async DevServer.renderPageComponent (node_modules/next/src/server/base-server.ts:3597:15)
    at async DevServer.renderToResponseImpl (node_modules/next/src/server/base-server.ts:3659:23)
    at async DevServer.pipeImpl (node_modules/next/src/server/base-server.ts:1698:20)
    at async NextNodeServer.handleCatchallRenderRequest (node_modules/next/src/server/next-server.ts:1034:6)
    at async DevServer.handleRequestImpl (node_modules/next/src/server/base-server.ts:1462:8)
    at async (node_modules/next/src/server/dev/next-dev-server.ts:514:13)
    at async Span.traceAsyncFn (node_modules/next/src/trace/trace.ts:143:13)
    at async DevServer.handleRequest (node_modules/next/src/server/dev/next-dev-server.ts:512:19)
    at async invokeRender (node_modules/next/src/server/lib/router-server.ts:284:10)
    at async handleRequest (node_modules/next/src/server/lib/router-server.ts:530:15)
    at async requestHandlerImpl (node_modules/next/src/server/lib/router-server.ts:576:6)
    at async Server.requestListener (node_modules/next/src/server/lib/start-server.ts:146:6)
  18 |   statusCode: RedirectStatusCode = RedirectStatusCode.TemporaryRedirect
  19 | ): RedirectError {
> 20 |   const error = new Error(REDIRECT_ERROR_CODE) as RedirectError
     |                ^
  21 |   error.digest = `${REDIRECT_ERROR_CODE};${type};${url};${statusCode};`
  22 |   return error
  23 | } {
  digest: 'NEXT_REDIRECT;push;http://localhost:3000/;307;'


I am kind of at a loss here and ChatGPT/Copilot are giving me useless answers. What should I be looking at here?

1 Reply

Avatar
FWIW I deleted the db entry so there's nothing in the db.
Image