Next.js · build error
Server Actions must be async functions
Error: Server Actions must be async functions.What it means
Every function exported from a file that starts with "use server" (or marked "use server" inline) is a Server Action, and Server Actions have to be async.
Common causes
- A plain helper or constant exported from actions.ts
- An agent put "use server" at the top of a utils file
How to fix it
- Make each exported action async
- Move non-action helpers and constants out of the "use server" file
- Don't use "use server" to mean "server-only": that's what import "server-only" is for
"use server";
- export function save(formData: FormData) {
+ export async function save(formData: FormData) {
// …
}Prompt for Cursor or Claude Code
Next.js says Server Actions must be async. In every "use server" file, make exported actions async and move any non-action exports (helpers, constants, types used at runtime) into a separate module.Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Next.js error fixer.
next: skip the next one
Skip the setup. The VibeBoot SaaS Starter gives you auth, Stripe and a database already wired on Next.js 16.4.3, with AGENTS.md and .cursor/rules that keep your agent on the Next.js 16 conventions. $49, one-time.
14-day money-back guarantee · lifetime updates
Other Next.js errors
- useState / useEffect in a Server Component
- Event handlers cannot be passed to Client Component props
- Functions cannot be passed directly to Client Components
- Only plain objects can be passed to Client Components
- "use client" must be placed before other expressions
- export "metadata" from a "use client" page
$ fixed it? get the next one first
New fixes for what AI agents break, by email.
When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.