Server actions must be async functions Next.js Origin: On your device OSI layer 7 · Application Last updated 5 Nov 2026

Next.js: Error: Server actions must be async functions

A function marked "use server" isn't declared async.

Exact message you may see Server actions must be async functionsError: Only async functions are allowed to be exported in a "use server" fileA "use server" file can only export async functions, found objectServer Actions must be async functions
Seen on: Next.js React

Meaning

Server Actions are invoked over the network and must return a Promise. Add async to every exported function in a "use server" file. In files with "use server" only async function exports are allowed (constants/types can't be exported).

Common causes

  • Missing async keyword
  • Exporting a non-function value from a "use server" file
  • Arrow function exported without async
  • Inline action without async
  • Re-exporting synchronous helpers

⚡ Quick fix

  1. export async function save(formData: FormData) {}
  2. Keep non-async helpers in a separate file without "use server"
  3. Move constants to another module

Detailed fix by platform

Next.js

  1. tsx
    "use server";
    export async function createPost(formData: FormData) { /* ... */ }

How to diagnose

  1. Keyword — async?
  2. Exports — Only async functions?
  3. Helpers — Separate file?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Body exceeded 1 MB limit (Server Actions) — Next.js: Error: Body exceeded 1 MB limit. To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit (Next.js)Body exceeded 1 MB li…Conflicting app and page file was found — Next.js: ⨯ Conflicting app and page file was found, please remove the conflicting files to continue: "pages/index.tsx" - "app/page.tsx" (Next.js)Conflicting app and p…CORS error calling Next.js API route / route handler — Browser: Access to fetch at 'https://api.example.com/api/data' from origin 'https://app.example.com' has been blocked by CORS policy (Next.js route handler) (Next.js)CORS error calling Ne…Failed to find Server Action — Next.js: Error: Failed to find Server Action "abc123". This request might be from an older or newer deployment (Next.js)Failed to find Server…next build: fetch failed ECONNREFUSED (build-time API) — Next.js: Error occurred prerendering page "/blog" TypeError: fetch failed { cause: Error: connect ECONNREFUSED 127.0.0.1:3000 } (Next.js)next build: fetch fai…next build: JavaScript heap out of memory — Next.js: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory (during next build) (Next.js)next build: JavaScrip…Only plain objects can be passed to Client Components — Next.js: Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported (Next.js)Only plain objects ca…Route used revalidatePath during render — Next.js: Error: Route /blog used "revalidatePath /blog" during render which is unsupported. It must happen outside of renders and cached functions (Next.js)Route used revalidate…Server ac…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.