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

Error: headers was called outside a request scope, when using Authjs v5.0.0-beta.19 and next dev --turbo #69516

Open
fprl opened this issue Aug 30, 2024 · 9 comments
Labels
bug Issue was opened via the bug report template. Turbopack Related to Turbopack with Next.js.

Comments

@fprl
Copy link

fprl commented Aug 30, 2024

Link to the code that reproduces this issue

https://github.com/cogb-jclaney/authjs-issue

To Reproduce

Hi, I'm bringing this issue nextauthjs/next-auth#11076 to here as its related to turbopack.

image

Current vs. Expected behavior

Expected behavior should be to work, as it does when there is no --turbo flag.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:21 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.0.0
  npm: 10.5.1
  Yarn: 3.6.3
  pnpm: 9.8.0
Relevant Packages:
  next: 14.2.7 // Latest available version is detected (14.2.7).
  eslint-config-next: 14.2.7
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

@fprl fprl added the bug Issue was opened via the bug report template. label Aug 30, 2024
@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label Aug 30, 2024
@timneutkens
Copy link
Member

Did you use next@canary? The reproduction shows 14.2: https://github.com/cogb-jclaney/authjs-issue/blob/main/package.json#L40

@fprl
Copy link
Author

fprl commented Sep 10, 2024

Hi Tim, yes, although the repro (not mine) shows 14.2, in my case I was using next@canary and also react@canary.

@balazsorban44
Copy link
Member

Hi @fprl, I could not reproduce any issues, given the reproduction URL!

The error on the screenshots looks to be from a different codebase than the code itself.

Can you give reproduction steps with the simplified codebase?

@fprl
Copy link
Author

fprl commented Sep 19, 2024

Hi @balazsorban44 thanks for checking it out. Yes, the image is mine but the issue from next-auth was using the same version as I did. I will create a new repro and link it here.

@balazsorban44
Copy link
Member

balazsorban44 commented Sep 19, 2024

Make sure to check out with the latest version, which is 5.0.0-beta.21 as of writing

@fprl
Copy link
Author

fprl commented Sep 19, 2024

Clear, thanks a lot

@fprl
Copy link
Author

fprl commented Sep 26, 2024

Sorry for my delay. I've been debugging this issue and I realise that this error appears only in a monorepo setup. Is there some way to debug this in a better way?

@luannguyenQV
Copy link

I upgrade next-auth to 5.0.0-beta.21 and it works like a charm.
Here: https://github.com/CodeForStartup/turborepo-nextjs-prisma-postgres

@JulianKingman
Copy link

JulianKingman commented Nov 7, 2024

Still an issue in beta 25, linked issue in authjs: nextauthjs/next-auth#11076

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

5 participants