You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Copy .env.example as .env and set up the required Clerk .env variables.
Run with bun dev.
Expected behavior:
Should not cause any errors.
Actual behavior:
Causes below error.
⨯ unhandledRejection: Error: Clerk: auth() and currentUser() are only supported in App Router (/app directory).
If you're using /pages, try getAuth() instead.
Original error: Error: During prerendering, `headers()` rejects when the prerender is complete. Typically these errors are handled by React but if you move `headers()` to a different context by using `setTimeout`, `unstable_after`, or similar functions you may observe this error and you should handle it in that context.
at buildRequestLike (turbopack://[project]/node_modules/@clerk/nextjs/src/app-router/server/utils.ts:35:10)
at async getDynamicClerkState2 (turbopack://[project]/node_modules/@clerk/nextjs/src/app-router/server/ClerkProvider.tsx:17:18)
33 | }
34 |
> 35 | throw new Error(
| ^
36 | `Clerk: auth() and currentUser() are only supported in App Router (/app directory).\nIf you're using /pages, try getAuth() instead.\nOriginal error: ${e}`,
37 | );
38 | }
I'm using Next.js app router with the following versions. It's been happening with all @clerk/nextjs@^6 versions as well as all Canary and RC versions of Next 15 and React 19, not specific to these ones.
Preliminary Checks
I have reviewed the documentation: https://clerk.com/docs
I have searched for existing issues: https://github.com/clerk/javascript/issues
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://github.com/Jussinevavuori/clerk-next15-ppr-dynamicio-headers-issue
Publishable key
pk_test_ZnJlc2gtcmFtLTkxLmNsZXJrLmFjY291bnRzLmRldiQ
Description
Steps to reproduce:
bun install
..env.example
as.env
and set up the required Clerk.env
variables.bun dev
.Expected behavior:
Should not cause any errors.
Actual behavior:
Causes below error.
Environment
The text was updated successfully, but these errors were encountered: