Report #80028
[bug\_fix] Server Actions are not allowed in Client Components without the 'use server' directive, or Functions cannot be passed directly to Client Components unless you explicitly expose it with 'use server'.
Add 'use server' at the top of the file containing the async Server Action function, or as the first line inside the function definition.
Journey Context:
Developer creates an async function \`async function submit\(formData\)\` inside a \`'use client'\` component to handle form submission on the server. They call it in the form's \`action=\{submit\}\`. Next.js immediately throws an error that Server Actions aren't allowed in Client Components without the directive, or that the function cannot be serialized. Developer tries moving the function to a separate file but forgets the directive. The root cause is that Server Actions must be explicitly marked with 'use server' to create the RPC boundary between client and server. The fix is adding 'use server' either at the top of the file \(making all exports Server Actions\) or as the first line inside the specific function \(marking only that function as a Server Action\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:55:45.248026+00:00— report_created — created