Summary
Vercel Functions now accept inbound request bodies up to 20MiB, up from 4.5MB, in Public Beta. To turn this on, set the VERCEL_SUPPORT_LARGE_REQUEST_BODY=1 environment variable. The opt-in applies to the whole project in the environment where you set it, so you can test the larger limit on preview before enabling it in production. It requires the project's functions to use the performance memory setting of 4GB. It applies to functions on the Node.js, Python, and Bun runtimes, and to Routing Middleware. Functions and Routing Middleware on the Edge runtime keep the 4.5MB cap and return 413 on oversize bodies, so moving them onto the larger limit means switching to the Node.js runtime with runtime: 'nodejs' , or proxy.ts in Next.js. When a project opts in, Routing Middleware receives request headers and metadata but no request body, enforced at the project level. Middleware still runs and still sees every other request header, so body-dependent middleware behavior is the one thing that be…
Original text(via Vercel Blog)
Vercel Functions now accept inbound request bodies up to 20MiB, up from 4.5MB, in Public Beta.
To turn this on, set the VERCEL_SUPPORT_LARGE_REQUEST_BODY=1 environment variable. The opt-in applies to the whole project in the environment where you set it, so you can test the larger limit on preview before enabling it in production. It requires the project's functions to use the performance memory setting of 4GB. It applies to functions on the Node.js, Python, and Bun runtimes, and to Routing Middleware. Functions and Routing Middleware on the Edge runtime keep the 4.5MB cap and return 413 on oversize bodies, so moving them onto the larger limit means switching to the Node.js runtime with runtime: 'nodejs', or proxy.ts in Next.js.
When a project opts in, Routing Middleware receives request headers and metadata but no request body, enforced at the project level. Middleware still runs and still sees every other request header, so body-dependent middleware behavior is the one thing that becomes unavailable. This avoids sending the body twice, to both middleware and the target function, which would raise cost and time to first byte.
When handling larger request bodies, read the body promptly and avoid holding it in memory to prevent backpressure and memory issues.
Learn more in the Vercel Functions limitations documentation.
The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.
Published by Vercel Blog
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗