Skip to content

About

Minimal repro: Clerk's post-auth client-side push into a route that server-redirects leaves the Next.js router hung

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Clerk + Next.js: client router hangs on a post-auth redirect

Minimal reproduction of a hang that occurs when Clerk performs its post-authentication client-side navigation into a route that immediately calls redirect() on the server.

Derived from clerk/clerk-nextjs-app-quickstart with four routes added. Nothing else is modified.

Symptom

After signing in with forceRedirectUrl pointing at a Server Component that calls redirect(), the client router never commits the navigation. The page sits on the Next.js Rendering… indicator indefinitely, parked on the intermediate route.

Observed alongside it:

  • The server completes normally. The redirect target returns 200, twice.
  • No console errors.
  • The header renders the signed-out state (Sign in / Sign Up) despite authentication having succeeded.
  • A page reload clears it, so this is stuck client router state, not a server deadlock.

Versions

Package Version
@clerk/nextjs 7.7.4 (latest as of 2026-08-11)
@clerk/shared 4.28.1
@clerk/react 6.14.1
next 16.2.10
react / react-dom 19.2.5

Reproduced on 7.5.18, 7.7.1, and 7.7.4. The hang is present on the latest published release, not something already fixed upstream.

Setup

pnpm install

pnpm-workspace.yaml carries minimumReleaseAge: 2880 from the upstream quickstart, which blocks packages published in the last 48 hours. Since this repro pins a release that was recent at the time of writing, @clerk/* is listed in minimumReleaseAgeExclude so the pinned versions install. Remove that exclusion once the pin is older than the window.

Add a Clerk development instance's keys to .env.local:

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
pnpm dev

Then open /repro.

The routes

Route Contents
/repro Harness. Sign-in buttons with forceRedirectUrl, plus plain <Link>s to the same routes.
/setup Server Component: await auth() then redirect('/landed').
/plain Server Component: redirect('/landed'). Never touches Clerk.
/landed Renders LANDED OK.

Results

Sign out between runs — the harness has a sign-out button.

Trigger Destination Result
<Link> click, signed out /setup lands
<Link> click, signed out /plain lands
<Link> click, signed in /setup lands
Post-auth push /setup hangs, URL parks on /setup
Post-auth push /plain hangs, URL parks on /plain

The single variable is Clerk's post-authentication push.

  • Not caused by auth() on the destination — the Clerk-free /plain control fails identically.
  • Not caused by being signed in — the same route reached via <Link> while signed in works.
  • Not caused by the redirect itself — the same route redirects fine on every other path.

The loading.tsx workaround does not work

A commonly suggested fix is to add a loading.tsx so the redirecting segment gets a Suspense boundary. Adding app/setup/loading.tsx (the segment that redirects, not a route-group root) does not resolve the hang.

Server log during a hang

POST /repro 200
  └─ ƒ invalidateCacheAction() in 9ms   ← @clerk/nextjs/dist/esm/app-router/server-actions.js
GET  /setup  200
GET  /landed 200
GET  /landed 200

invalidateCacheAction() firing concurrently with the in-flight navigation is a suspected contributor, not a traced cause. It is noted here as a starting point, not a conclusion.

About

Minimal repro: Clerk's post-auth client-side push into a route that server-redirects leaves the Next.js router hung

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages