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

Next.js 15 canary with experimental PPR + dynamicIO issue calling headers() #4445

Open
4 tasks done
Jussinevavuori opened this issue Nov 1, 2024 · 2 comments
Open
4 tasks done
Labels
needs-triage A ticket that needs to be triaged by a team member

Comments

@Jussinevavuori
Copy link

Preliminary Checks

Reproduction

https://github.com/Jussinevavuori/clerk-next15-ppr-dynamicio-headers-issue

Publishable key

pk_test_ZnJlc2gtcmFtLTkxLmNsZXJrLmFjY291bnRzLmRldiQ

Description

Steps to reproduce:

  1. Clone reproduction repo.
  2. Install dependencies with bun install.
  3. Copy .env.example as .env and set up the required Clerk .env variables.
  4. 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 |   }

Environment

System:
    OS: macOS 15.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 201.53 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.2 - ~/.nvm/versions/node/v18.20.2/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.2/bin/yarn
    npm: 10.5.0 - ~/.nvm/versions/node/v18.20.2/bin/npm
    pnpm: 9.0.1 - ~/.nvm/versions/node/v18.20.2/bin/pnpm
    bun: 1.1.32 - ~/.bun/bin/bun
    Watchman: 2024.10.28.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 130.0.6723.92
    Safari: 18.1
@Jussinevavuori Jussinevavuori added the needs-triage A ticket that needs to be triaged by a team member label Nov 1, 2024
@panteliselef
Copy link
Member

@Jussinevavuori are you still experiencing this issue in the new major @clerk/nextjs@6 ?

@Jussinevavuori
Copy link
Author

Yes. Still getting the error.

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.

"@clerk/nextjs": "^6.5.0"
"next": "^15.0.4-canary.28"
"react": "^19.0.0-rc.1"
"react-dom": "^19.0.0-rc.1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage A ticket that needs to be triaged by a team member
Projects
None yet
Development

No branches or pull requests

2 participants