Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signoutData might be undefined #823

Open
LLCampos opened this issue Jul 19, 2024 · 1 comment
Open

signoutData might be undefined #823

LLCampos opened this issue Jul 19, 2024 · 1 comment
Labels
bug A bug that needs to be resolved p2 Nice to have

Comments

@LLCampos
Copy link

LLCampos commented Jul 19, 2024

Environment

- Node Version:     v18.17.0
- Nuxt Version:     3.11.2
- CLI Version:      3.11.1
- Nitro Version:    2.9.6
- Package Manager:  [email protected]
- User Config:      experimental, extends, modules, sourcemap, app, css, postcss, auth, vite, runtimeConfig
- Runtime Modules:  @sidebase/nuxt-auth@^0.7.2, @pinia/[email protected], @formkit/[email protected], @nuxt/[email protected], @nuxtjs/tailwindcss@^6.8.0, floating-vue/nuxt
- Build Modules:    -

Reproduction

This is a non-deterministic problem. Not able to reproduce it consistently.

Describe the bug

We've been non-deterministically been getting the error

TypeError: undefined is not an object (evaluating 'o.url') / TypeError: o is undefined

The source maps tell me that the error is happening here.

So it seems that somehow signoutData might be undefined at this point?

Additional context

  • This leads to an error page in Netlify.
  • This error is paired sometimes (but not always) with TypeError: NetworkError when attempting to fetch resource.

I'll add more context here if I find anything new.

Logs

No response

@LLCampos LLCampos added bug A bug that needs to be resolved pending An issue waiting for triage labels Jul 19, 2024
@phoenix-ru
Copy link
Collaborator

Hi @LLCampos . I checked and it's probably caused by redirects

Here's what next-auth v4 does:

POST:
https://github.com/nextauthjs/next-auth/blob/8fd11333c5f5d426a741674b0a02def723e4aa31/packages/next-auth/src/core/index.ts#L254-L261

And here's how we handle it in 0.8:

if (nextRequest.body?.json) {
return { url: nextResult.redirect }
}
// 3.3 via a redirect:
return await sendRedirect(event, nextResult.redirect)

So, the body with url is only returned when next-auth returns a body with JSON, thus probably making the problem inconsistent for you.

Since we are working on a revamp of authjs in #818, it might be the case that this problem is solved there. Please keep an eye out on a new release to see if it helps.

@phoenix-ru phoenix-ru added p2 Nice to have and removed pending An issue waiting for triage labels Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved p2 Nice to have
Projects
None yet
Development

No branches or pull requests

2 participants