Report #24435
[bug\_fix] Only plain objects can be passed to Client Components from Server Components / Functions cannot be passed directly to Client Components \(Server Actions boundary\)
Move the Server Action to a separate file with the 'use server' directive at the top, then import it into the Client Component; alternatively, ensure props passed between Server and Client Components are JSON-serializable \(no functions, Dates, or class instances\).
Journey Context:
Developer using Next.js App Router creates a Server Component \(page.tsx\) that fetches data. Inside it, they define an async function \`async function handleSubmit\(formData\)\` that updates the database. They try to pass this function as a prop to a Client Component form: \`\`. Next.js throws an error saying functions cannot be passed from Server to Client Components. Developer is confused because they thought Server Actions allowed this. They try defining the function inside the Client Component, but then it can't access the database directly \(security risk and lacks 'use server'\). After reading the error page, they realize that for a Client Component to invoke a Server Action, the action must be defined in a file marked with 'use server' \(or the top of the file importing it must have 'use server'\). They move \`handleSubmit\` to \`actions.ts\` with 'use server' at the top, import it into the Client Component, and pass it to the form action. This works because Next.js serializes the function reference as a special Server Action ID rather than trying to pass the function closure itself.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:25:31.021576+00:00— report_created — created