Cannot return client components from imported server actions
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/AlessioGr/nextjsserveractionbug
To Reproduce
- pnpm dev
- visit http://localhost:3000/fails. The error will appear
- visit http://localhost:3000/works. This will work as expected
Current vs. Expected behavior
Server action: imports a client component (, renders it) and returns it.
✅ What works - passing down server action: (http://localhost:3000/works)
If you import the server action in the RSC Page, pass it down to the client component as a prop and then call it from the client component, it will work as expected: Server Action renders the client component, passes it down to the client, which then renders the returned component.
❌ What does not work - importing server action directly: (http://localhost:3000/fails)
Instead of importing the server action on the server and passing it down, import the server action directly in your client component and then call it. This will throw the following error:
⨯ Error: Could not find the module "[project]/app/fails/Repro/SimpleClientComponent.tsx#SimpleClientComponent" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
at stringify (<anonymous>) {
digest: '2675070991'
}
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 16
Binaries:
Node: 24.0.1
npm: 10.9.0
Yarn: N/A
pnpm: 10.11.0
Relevant Packages:
next: 15.5.2 // Latest available version is detected (15.5.2).
eslint-config-next: 15.5.2
react: 19.1.0
react-dom: 19.1.0
typescript: 5.9.2
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Webpack, Turbopack, Server Actions
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local)
Additional context
- Rendering the client component in the server action is fine. The issue only appears if you return the rendered client component from the server action
- Rendering server components and returning them in the server action is fine. The issue only appears if it's a 'use client' client component.
- Both rendering the client component and returning it, as well as not rendering it and just returning a reference to the client component, will trigger the issue
- This happens on both turbopack and webpack.
- This happens on both Next.js 15.5.2 and 15.0.0
- This happens in both dev and build
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Clone the linked reproduction and run pnpm dev, then compare /fails with /works. Start with the server-action imports and app/fails/Repro/SimpleClientComponent.tsx, using the React Client Manifest error as the failure point. Done means directly importing and calling the server action no longer fails when it returns a client component in dev and build with both Webpack and Turbopack.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, react, webpack
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100