Vercel 413 FUNCTION_PAYLOAD_TOO_LARGE: the 4.5 MB request body limit, the new 20 MiB opt-in (Nov 2026), and when to upload straight to storage

Your AI-built app works locally, then on Vercel the file upload or a big webhook fails with 413: FUNCTION_PAYLOAD_TOO_LARGE. That's the 4.5 MB limit on the request body a Vercel Function accepts. On 20 November 2026 Vercel added a public-beta opt-in that raises it to 20 MiB, but only for projects that can use the 4 GB Performance memory setting, which means Pro or Enterprise. Here's what the error means, how to turn the larger limit on, what it breaks, and the fix that works on Hobby too: send the file straight to storage instead of through your function.

Short answer

413 FUNCTION_PAYLOAD_TOO_LARGE means the request body sent to your Vercel Function was over the limit: 4.5 MB by default. Since 20 Nov 2026 you can raise it to 20 MiB (public beta) by setting the environment variable VERCEL_SUPPORT_LARGE_REQUEST_BODY=1 and redeploying, if the project uses fluid compute, the Node.js, Python or Bun runtime, and Performance memory (4 GB / 2 vCPUs), which only Pro and Enterprise can select. With it on, Routing Middleware no longer sees request bodies, and Edge runtime functions stay at 4.5 MB. On Hobby, or for anything bigger than 20 MiB, upload from the browser directly to storage (Vercel Blob client uploads, or a Supabase Storage signed upload URL) and send only the file URL to your function. In Next.js, Server Actions have their own 1 MB default (bodySizeLimit), separate from Vercel's limit.

What the error means

Vercel returns 413: FUNCTION_PAYLOAD_TOO_LARGE when a request is bigger than the request body limit of the function that handles it. Vercel's docs put the default at 4.5 MB, and its knowledge base names the usual cause: uploading large files through a function.

Typical places an AI-built app hits it: a profile-photo or document upload that posts the file to /api/upload, a form that sends images as base64 inside JSON (which makes them bigger), or a webhook from another service that sends a large payload.

  • Request too large (client → function): 413 FUNCTION_PAYLOAD_TOO_LARGE. This is what the new 20 MiB opt-in changes.
  • Response too large (function → client): Vercel's response body limit is 4.5 MB except for streamed responses, and its knowledge base says this can also show up as a 500 FUNCTION RESPONSE PAYLOAD TOO LARGE. The 20 MiB opt-in doesn't change response size; stream the response or let the client fetch the file from storage.

What changed on 20 November 2026

Vercel's changelog of 20 November 2026 says Vercel Functions now accept inbound request bodies up to 20 MiB, up from 4.5 MB, in public beta. It's opt-in per project and per environment, so you can try it on Preview before Production.

Vercel Functions request body limit, per Vercel's changelog and Functions limits docs (checked 23 Nov 2026)
SetupRequest body limitNotes
Default (any plan, any runtime) 4.5 MB Over the limit returns 413 FUNCTION_PAYLOAD_TOO_LARGE
Opted in: Node.js, Python or Bun functions, fluid compute, Performance memory (4 GB) 20 MiB (public beta) Set VERCEL_SUPPORT_LARGE_REQUEST_BODY=1 in that environment, then redeploy
Opted in: Routing Middleware (Node.js) Receives headers and metadata, but no body Applies to the whole project once you opt in
Edge runtime functions and Edge middleware 4.5 MB, even when opted in Switch to the Node.js runtime to get the larger limit
Hobby 4.5 MB Hobby can't select Performance memory, which the opt-in requires

20 MiB is 20 × 1,048,576 = 20,971,520 bytes, slightly more than 20 MB. Leave headroom: a multipart form adds boundaries and field headers on top of the file itself.

How to turn on the 20 MiB limit

These steps follow Vercel's Functions limits docs. You need a Pro or Enterprise team.

  • Check fluid compute is on: project Settings → Functions → Fluid Compute. Vercel says it's on by default for projects created since 23 April 2025.
  • Set Performance memory: project Settings → Functions → Function CPU → Performance (4 GB / 2 vCPUs). Vercel notes you can't set memory in vercel.json, and the change only applies to new deployments.
  • Add the environment variable VERCEL_SUPPORT_LARGE_REQUEST_BODY with the value 1, first for Preview only.
  • Redeploy, then test an upload between 4.5 MB and 20 MiB on the preview URL.
  • Make sure the route doesn't run on the Edge runtime. In Next.js, remove export const runtime = 'edge' from that route or use runtime: 'nodejs'; Vercel's changelog also points to proxy.ts for middleware.
  • When it works, add the same variable to Production and redeploy.
Vercel CLI (add the opt-in to Preview first, then redeploy)
vercel env add VERCEL_SUPPORT_LARGE_REQUEST_BODY preview
# enter 1 when asked for the value
vercel deploy

The catches before you flip it on

  • Middleware loses the body for the whole project. If your middleware reads the request body, for example to verify a webhook signature or check a form, move that logic into the route itself before you opt in. Vercel says middleware still runs and still sees every other header.
  • It costs more to run. Performance memory doubles memory and CPU, and Vercel bills Provisioned Memory at a higher GB-hour rate for larger memory settings. It applies to every function in the project, not just the upload route.
  • It's a beta. Vercel hasn't published a general-availability date, and the behaviour can change while it's in beta.
  • Read the body promptly. Vercel recommends reading large bodies as soon as they arrive and not holding them in memory, to avoid backpressure and memory problems.
  • 20 MiB is still small for video or large PDFs. If users might upload more, the direct-to-storage approach below is the real fix.

The fix that works on every plan: upload straight to storage

Vercel's own advice for large files is not to send them through a function at all. The browser uploads the file directly to storage, and your function only hands out short-lived permission and saves the resulting URL. The function never sees the file, so the body limit doesn't matter. This works on Hobby, Pro and Enterprise.

  • Vercel Blob client uploads: the browser calls upload() from @vercel/blob/client, and a small route using handleUpload() generates a token. Vercel lists a maximum file size of 5 TB and recommends multipart uploads above 100 MB.
  • Authenticate inside onBeforeGenerateToken. Vercel's example warns that skipping the check lets anyone upload anonymously to your store. Limit allowedContentTypes to what you expect.
  • Supabase Storage (common with Lovable and Bolt apps): create a signed upload URL on the server with createSignedUploadUrl() (valid for 2 hours), then upload from the browser with uploadToSignedUrl(). Supabase recommends standard uploads only up to 6 MB and resumable (TUS) uploads above that. Free projects have a 50 MB per-file limit; Pro and up can raise it to 500 GB.
  • Then send only the file's URL or path to your API route, which stays far below 4.5 MB.
app/api/upload/route.ts (Vercel Blob token route, shortened from Vercel's docs)
import { handleUpload, type HandleUploadBody } from '@vercel/blob/client';
import { NextResponse } from 'next/server';

export async function POST(request: Request) {
  const body = (await request.json()) as HandleUploadBody;
  const json = await handleUpload({
    body,
    request,
    onBeforeGenerateToken: async () => {
      // Check the user is signed in here, or anyone can upload.
      return { allowedContentTypes: ['image/jpeg', 'image/png', 'application/pdf'] };
    },
    onUploadCompleted: async ({ blob }) => {
      // Save blob.url to your database. Doesn't run on localhost.
    },
  });
  return NextResponse.json(json);
}

Vercel notes that onUploadCompleted can't reach localhost, so test the full flow on a preview deployment or through a tunnel.

Next.js Server Actions have their own 1 MB limit

If the upload goes through a Server Action (a form with action={...} in Next.js), Next.js caps the request body at 1 MB by default, regardless of where you host. You can raise it with experimental.serverActions.bodySizeLimit in next.config.js. The limit counts the raw request, including multipart overhead, so Next.js suggests leaving 10–20 KB of headroom.

Raising bodySizeLimit above 4.5 MB on Vercel only helps if the project also has the 20 MiB opt-in; otherwise Vercel's limit applies first (our reading of the two docs together). For files, the direct-to-storage approach above avoids both limits.

next.config.js
/** @type {import('next').NextConfig} */
module.exports = {
  experimental: {
    serverActions: {
      bodySizeLimit: '4mb', // stay under Vercel's 4.5 MB default
    },
  },
};

Confirmed vs not published

What Vercel has and hasn't documented about the 20 MiB opt-in (checked 23 Nov 2026)
QuestionStatus
Default limit 4.5 MB, 413 FUNCTION_PAYLOAD_TOO_LARGE Confirmed (Vercel docs)
20 MiB via VERCEL_SUPPORT_LARGE_REQUEST_BODY=1, public beta since 20 Nov 2026 Confirmed (Vercel changelog)
Needs fluid compute and Performance (4 GB) memory; Node.js, Python, Bun only Confirmed (Vercel docs)
Available on Hobby No: Performance memory is Pro and Enterprise only
Middleware loses access to request bodies once enabled Confirmed (Vercel changelog and docs)
Response body limit raised No: still 4.5 MB except streamed responses
General-availability date, future limit above 20 MiB, Hobby support later Not published by Vercel
Whether the limit is measured before or after compression Not stated by Vercel

Common questions

What is the request body size limit for Vercel Functions?

4.5 MB by default. Since 20 November 2026, Pro and Enterprise projects can opt in to 20 MiB (public beta) for Node.js, Python and Bun functions with fluid compute and Performance (4 GB) memory, by setting VERCEL_SUPPORT_LARGE_REQUEST_BODY=1 and redeploying.

How do I fix 413 FUNCTION_PAYLOAD_TOO_LARGE on Vercel?

For file uploads, upload from the browser straight to storage (Vercel Blob client uploads or a Supabase Storage signed upload URL) and send only the URL to your function. If the payload is under 20 MiB and you're on Pro or Enterprise, you can instead turn on the 20 MiB opt-in. Otherwise, make the payload smaller or split it into several requests.

Can I use the 20 MiB limit on the Vercel Hobby plan?

No. The opt-in requires the Performance (4 GB) memory setting, and Vercel says Hobby projects always use the default 2 GB. On Hobby, use client uploads to Vercel Blob or another storage service.

Does VERCEL_SUPPORT_LARGE_REQUEST_BODY work for Edge functions?

No. Functions and Routing Middleware on the Edge runtime keep the 4.5 MB cap and return 413 for larger bodies. Switch the route to the Node.js runtime to use the larger limit.

Why does my middleware stop seeing the request body?

When a project opts in to large request bodies, Vercel sends Routing Middleware the headers and metadata but not the body, for the whole project. Vercel says this avoids sending the body twice. Move body-dependent checks into the route handler.

Is it the same as the Next.js Server Actions body size limit?

No. Next.js limits Server Action request bodies to 1 MB by default, on any host; you change it with experimental.serverActions.bodySizeLimit. Vercel's 4.5 MB (or 20 MiB) function limit applies on top of that.

Related on VibeLiftoff