afaqrashid.com  ·  portfolio · 2026 ed.

Next.js Server Actions Body Size Limit: "Body Exceeded 1 MB Limit" Tested

Next.js limits the request body of a Server Action to 1 MB by default. Anything bigger is rejected before your function runs, with "Error: Body exceeded 1 MB limit." and status 413. It mostly bites file uploads through a form action, and actions that send a large JSON payload or a base64 image.

I tested it on Next.js 16.4.4 with two actions, one taking a string and one taking a File in FormData, at sizes from 0.5 MB to 2 MB, in next dev and next start.

What happened

payload            default limit                       bodySizeLimit: "3mb"
string 0.5 MB      ok                                  ok
string 0.99 MB     ok                                  -
string 1.1 MB      fails                               ok
string 2 MB        fails                               ok
file 0.5 MB        ok                                  -
file 1.1 MB        fails                               -
file 2 MB          fails                               ok

The server log was the same in dev and production:

⨯ 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
  statusCode: 413

What the browser got was not. In next dev, the error my client code caught had the real message, "Body exceeded 1 MB limit." In production it was "Minified React error #441", which React's docs describe as an error in the Server Components render whose message is left out of production builds on purpose. So users, and any error reporting that runs in the browser, see a generic failure. If uploads fail only in production with #441, check the server logs for 413.

The fix: bodySizeLimit

// next.config.ts
import type { NextConfig } from "next";

const config: NextConfig = {
  experimental: {
    serverActions: {
      bodySizeLimit: "3mb",
    },
  },
};

export default config;

After a rebuild, the 2 MB string and the 2 MB file both went through. The value takes a number of bytes or a string like "500kb" or "3mb". The limit is for the whole request body, so leave some room above the largest file you expect.

Check the limit wherever the request lands

Raising the Next.js limit doesn't raise anyone else's. Vercel documents a 4.5 MB maximum request body for functions, and reverse proxies such as nginx have their own (client_max_body_size). If uploads work locally and fail once deployed, check those before the Next.js setting.

When not to send files through a Server Action

The limit is there to protect your server: every byte goes through your server's memory. For anything beyond small images, such as video, PDFs or many photos at once, a better pattern is to upload straight from the browser to object storage (S3, R2, Supabase Storage and similar) with a short-lived signed URL, and send only the resulting file URL or key to your Server Action.

  • Server action: check the user is allowed to upload, and create a signed upload URL.
  • Browser: PUT the file directly to that URL.
  • Server action: save the file key with the record.

Checklist

  • "Body exceeded 1 MB limit" in the server log, #441 in the browser: it's the Server Actions limit.
  • Raise it with experimental.serverActions.bodySizeLimit, just above your real maximum.
  • Check your host's and proxy's own body limits.
  • Validate file size and type in the browser first, so users get a clear message instead of a generic error.
  • For large files, upload to storage with a signed URL and send only the key to the action.

Related

Sources