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

New UserButton.MenuItems component causing error #3925

Closed
4 tasks done
jdhenry08 opened this issue Aug 9, 2024 · 3 comments
Closed
4 tasks done

New UserButton.MenuItems component causing error #3925

jdhenry08 opened this issue Aug 9, 2024 · 3 comments

Comments

@jdhenry08
Copy link

Preliminary Checks

Reproduction

https://github.com/jdhenry08/clerk-nextjs-demo-app-router

Publishable key

pk_test_YWRhcHRlZC1mYXduLTQ0LmNsZXJrLmFjY291bnRzLmRldiQ

Description

Steps to reproduce:

  1. Sign up/sign in
  2. Navigate to the Dashboard page

Expected behavior:

Navigating to the dashboard should show the page (with an additional option in the UserButton menu)

Actual behavior:

Error: Could not find the module "/workspaces/clerk-nextjs-demo-app-router/node_modules/.pnpm/@clerk+nextjs@5.3.0_next@14.2.5_react-dom@18.2.0_react@18.2.0__react@18.2.0__react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@clerk/nextjs/dist/esm/client-boundary/uiComponents.js#UserButton#MenuItems" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

Environment

System:
    OS: Linux 6.5 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (2) x64 AMD EPYC 7763 64-Core Processor
    Memory: 5.33 GB / 7.74 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 20.15.1 - ~/nvm/current/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.7.0 - ~/nvm/current/bin/npm
    pnpm: 9.5.0 - ~/nvm/current/bin/pnpm
  npmPackages:
    @clerk/nextjs: ^5.3.0 => 5.3.0 
    @types/node: ^20.14.14 => 20.14.14 
    @types/react: ^18.3.3 => 18.3.3 
    @types/react-dom: ^18.3.0 => 18.3.0 
    @types/react-syntax-highlighter: ^15.5.13 => 15.5.13 
    clsx: ^2.1.1 => 2.1.1 
    next: ^14.2.5 => 14.2.5 
    postcss: ^8.4.41 => 8.4.41 
    prism-react-renderer: ^2.3.1 => 2.3.1 
    react: ^18.2.0 => 18.2.0 
    react-dom: ^18.2.0 => 18.2.0 
    react-syntax-highlighter: ^15.5.0 => 15.5.0 
    tailwindcss: ^3.4.9 => 3.4.9 
    typescript: ^5.5.4 => 5.5.4
@jdhenry08 jdhenry08 added the needs-triage A ticket that needs to be triaged by a team member label Aug 9, 2024
@linear linear bot removed the needs-triage A ticket that needs to be triaged by a team member label Aug 9, 2024
@EmmanouelaPothitou
Copy link
Contributor

You should add 'use client' to the parent component of UserButton. For example:
image

@jdhenry08
Copy link
Author

You should add 'use client' to the parent component of UserButton.

This works for the reproduction example, but not in my actual use case - the user button is part of a larger component that relies on being a server component.

If the MenuItems functionality requires being used in a client component, might I suggest making that clearer in the documentation at least?

@LekoArts
Copy link
Member

You might be able to fix this by changing your component tree and how you interleave the components: https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#interleaving-server-and-client-components
The underlying issue is probably: vercel/next.js#51593

Anyways, I've opened a docs PR to hopefully clear up that requirement: clerk/clerk-docs#1430

Thanks for opening the issue!

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

No branches or pull requests

3 participants