Server Action shape

next/server-actionserror / warningreactnextjs-16correctness

Why it matters

A "use server" module may only export async functions; inline actions cannot live in Client Components; action arguments are serialized so they cannot be functions; a <form action> in a Server Component must be a Server Action.

Fix

Make the export async (or move non-action exports elsewhere), move inline actions to a "use server" file, take serializable arguments, or add "use server" to the function body.

Credit

  • From the React team

    A 'use server' module exposes async functions as Server Actions whose arguments and results must be serializable.

  • From the Next.js team

    Specifies where Server Actions may be defined and how forms and mutations should call them.

References

See it