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

NextJS (App Router) Error with > v4.26.2 #2097

Closed
4 tasks done
tekmaven opened this issue Nov 9, 2023 · 2 comments · Fixed by #2101
Closed
4 tasks done

NextJS (App Router) Error with > v4.26.2 #2097

tekmaven opened this issue Nov 9, 2023 · 2 comments · Fixed by #2101

Comments

@tekmaven
Copy link

tekmaven commented Nov 9, 2023

Preliminary Checks

Reproduction / Replay Link

https://github.com/tekmaven/next-clerk-error-minimal-repo

Publishable key

pk_test_ZXF1YWwtdnVsdHVyZS04OC5jbGVyay5hY2NvdW50cy5kZXYk

Description

Steps to reproduce:
The issue occurs using @clerk/nextjs 4.26.2 or higher. When navigating to any NextJS app router page it errors. To repro, clone the repo and run

  1. npm install
  2. npm run build
  3. npm start
  4. Navigate to http://localhost:3000, which will result in an error: Application error: a server-side exception has occurred (see the server logs for more information).

Expected behavior:

NextJS App Router applications work properly. The repo should display next-clerk-error-minimal-repo layout, a user button, and Home.

Actual behavior:

The following error is output to the NextJS logs:

Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server".
  {actor: undefined, sessionClaims: ..., sessionId: ..., session: ..., userId: ..., user: ..., orgId: ..., orgRole: ..., orgSlug: ..., organization: ..., experimental__has: function}
                                                                                                                                                                             ^^^^^^^^
    at /home/ryan/Projects/next-clerk-error-minimal-repo/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:25042
    at Object.toJSON (/home/ryan/Projects/next-clerk-error-minimal-repo/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:25726)
    at stringify (<anonymous>)
    at eE (/home/ryan/Projects/next-clerk-error-minimal-repo/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:14115)
    at eR (/home/ryan/Projects/next-clerk-error-minimal-repo/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:14558)
    at Timeout._onTimeout (/home/ryan/Projects/next-clerk-error-minimal-repo/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:11338)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

If it's not clear above, the arrows are pointing to the word function in experimental__has: function.

Due to this, I believe this is a regression introduced in #1942, which lines up with v4.26.2 exhibiting this behavior.

Also note, this only happens when a next build and next start is run and does not occur with the dev server.

Environment

System:
    OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur)
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 44.79 GB / 62.70 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 10.2.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
  Browsers:
    Chrome: 119.0.6045.105
  npmPackages:
    @clerk/nextjs: ^4.27.0 => 4.27.0 
    @types/node: 20.9.0 => 20.9.0 
    @types/react: 18.2.37 => 18.2.37 
    @types/react-dom: 18.2.15 => 18.2.15 
    autoprefixer: 10.4.16 => 10.4.16 
    eslint: 8.53.0 => 8.53.0 
    eslint-config-next: 14.0.1 => 14.0.1 
    next: 14.0.1 => 14.0.1 
    postcss: 8.4.31 => 8.4.31 
    react: 18.2.0 => 18.2.0 
    react-dom: 18.2.0 => 18.2.0 
    tailwindcss: 3.3.5 => 3.3.5 
    typescript: 5.2.2 => 5.2.2
@tekmaven tekmaven added the needs-triage A ticket that needs to be triaged by a team member label Nov 9, 2023
@BRKalow
Copy link
Member

BRKalow commented Nov 9, 2023

Thank for the report! We've got a fix in progress that should be released shortly.

@dimkl
Copy link
Contributor

dimkl commented Nov 10, 2023

Hello @tekmaven 👋
Should be fixed in @clerk/[email protected].

@LekoArts LekoArts removed the needs-triage A ticket that needs to be triaged by a team member label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants