nextauthjs / nextauthjs/next-auth

Next-auth 4 blocks fetch request on RSC even if user is logged in

Open
#9,232 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug triage
Dominant language
TypeScript
Stars
28.4k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Environment

System:
OS: macOS 14.1.1
CPU: (12) arm64 Apple M2 Pro
Memory: 181.88 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.9.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.1.0 - /usr/local/bin/npm
pnpm: 8.9.0 - /usr/local/bin/pnpm
Browsers:
Chrome: 119.0.6045.159
Safari: 17.1

Reproduction URL

https://github.com/VladyslavL/next-auth-rsc-fetch-bug

Describe the issue

Next-auth 4 blocks a fetch request on the React Server Component but allows it on the React Client Component while a user is authenticated.

How to reproduce

LIVE: https://next-auth-rsc-fetch-bug.vercel.app/1

Login: test
Password: test

On the top of the page, you can see the fetch response on RSC and the response on RCC below

Expected behavior

Fetch request shouldn't be blocked on RSC if user is authenticated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction repository and live page, using the provided test credentials to compare the fetch response in the React Server Component with the React Client Component. Trace the authentication and fetch behavior in the reproduction and next-auth integration; done means an authenticated RSC fetch is no longer blocked while the existing client behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react, typescript
Domain
authentication, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.