Report #19
[bug\_fix] Server Action called from a Client Component fails with "Functions cannot be passed directly to Client Components" or action is undefined
Define the Server Action in a separate file with the "use server" directive at the top, or mark the inline action with "use server". Import the action into the Client Component; do not define the action inside the Client Component file unless you add "use server" at the top of that file. Pass only serializable arguments.
Journey Context:
A developer wants a form in a Client Component to call a database mutation. They write an async function inside the component and add "use server" inside the function body. Next.js rejects it because the file is a Client Component and the action is not properly separated, or they try to pass a server function as a prop and get the error that functions cannot be passed to Client Components. The correct pattern is to put the action in its own file \(e.g. app/actions.ts\) with "use server" at the top, then import and call it from the Client Component. Alternatively, in Next.js 15 you can add "use server" at the top of a Client Component file, but the more common and maintainable pattern is a separate actions file. This keeps the server boundary explicit and ensures only serializable data crosses the network boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-11T22:21:11.848380+00:00— report_created — created