deniz.in

Markets

Weather

Loading weather

· via Vercel blog

Vercel Functions lift the 4.5MB request body cap to 20MiB in public beta

Vercel Functions can now accept request bodies up to 20MiB in public beta, up from a long-standing 4.5MB cap, via an opt-in environment variable that excludes Edge runtime workloads.

Vercel Functions lift the 4.5MB request body cap to 20MiB in public beta

A higher ceiling for inbound payloads

Vercel has announced that Vercel Functions can now accept inbound request bodies up to 20MiB, a sharp increase from the previous 4.5MB limit. According to a post on the Vercel blog, the change is currently in public beta and is opt-in rather than automatic.

The old cap has long been a constraint for anyone building upload flows, image processing pipelines, or other features that post sizable payloads straight to a serverless function. Those workloads previously needed workarounds such as direct-to-storage uploads or routing traffic through an intermediate service.

How the opt-in works

To turn the feature on, a project sets the VERCEL_SUPPORT_LARGE_REQUEST_BODY environment variable to 1. As Vercel explains, the opt-in applies to the entire project within whichever environment it is configured, so teams can validate the larger limit on preview deployments before enabling it in production.

There are conditions attached. According to the changelog, the project's functions must use the performance memory setting of 4GB. The higher limit covers functions running on the Node.js, Python, and Bun runtimes, as well as Routing Middleware.

The Edge runtime is excluded

The Edge runtime is the notable exception. Vercel says functions and Routing Middleware running on Edge keep the existing 4.5MB cap and return a 413 status code when a body exceeds it. Projects that need the larger limit for code currently running at the edge must move that code to the Node.js runtime, either by specifying runtime: 'nodejs' or, in Next.js applications, by using proxy.ts.

A middleware trade-off

Opting in also changes how Routing Middleware behaves. When the flag is active for a project, middleware receives request headers and metadata but no longer receives the request body, an enforcement Vercel applies at the project level. Middleware still executes and can still inspect every other request header, so the one capability that disappears is middleware logic that depends on the body.

Vercel frames this as a deliberate design choice: forwarding the body to both middleware and the target function would send it twice, driving up cost and hurting time to first byte. Skipping the body in middleware avoids that duplication.

Guidance for handling big payloads

The changelog also offers practical advice for adopters: read the request body promptly and avoid holding it in memory, since lingering references to large bodies can cause backpressure and memory problems.

Why it matters

Body size limits are the kind of platform constraint that quietly shapes architecture. A 4.5MB ceiling pushes developers toward presigned uploads, external proxies, or splitting payloads into pieces, all extra moving parts for what is often a simple "accept this file" requirement. Raising the ceiling to 20MiB lets many mid-sized uploads go directly to a function, simplifying common patterns such as document ingestion, image manipulation, and webhook receivers with heavy payloads.

The trade-offs are worth reading closely, though. The feature requires a heftier memory configuration, leaves the Edge runtime untouched, and alters middleware semantics for the whole project. Teams relying on middleware that inspects request bodies, or running latency-sensitive functions at the edge, will need to weigh those constraints rather than flip the switch blindly. The public beta label also suggests details could still change, so testing on preview environments first, which the environment-scoped opt-in conveniently supports, is the sensible path.

  • #vercel
  • #serverless
  • #cloud
  • #node-js
  • #edge-computing

Related posts