← All articles

Vercel Functions 20MiB Uploads: Setup and Middleware Checks

Vercel's 20MiB request-body beta supports larger uploads but changes middleware access. Check runtimes, 4GB memory, Preview setup and rollout risks.

Vercel Functions can now accept request bodies up to 20MiB through an opt-in public beta. The important compatibility check is middleware: enabling the beta removes Routing Middleware’s access to request bodies across that project environment. For upload forms, document intake and product-data imports, evaluate the whole request path before changing production. November 20 announcement

The setup requirements below come from Vercel. The testing and rollout recommendations are my practical engineering advice, not a claim that a particular application has been certified or tested by Vercel.

What changed, and who can use it?

The beta increases the inbound limit from the default 4.5MB to 20MiB for Node.js, Python and Bun functions. It requires Fluid compute and Performance 4GB function memory, which Vercel lists for Pro and Enterprise. Edge retains the smaller cap. Response limits are separate: the documentation lists 4.5MB except for streamed responses. Current Functions limits

My view: this is useful when a modest upload needs server-side processing in an existing application. It is a reason to review a failing upload path, rather than a reason to route every file through your application server.

For example, a retailer importing a product CSV should care about validation, duplicate rows and recovery as much as whether the transport accepts the file. A larger accepted request does not tell the owner whether the catalogue was updated correctly.

How do you enable the beta?

Enable Fluid compute, choose Performance 4GB memory, set this environment variable and redeploy. Configuration requirements

VERCEL_SUPPORT_LARGE_REQUEST_BODY=1

Start with Preview. Record the current configuration and the deployment that works before introducing the change. Keep a clear way to restore both configuration and application code if a regression appears.

Treat this as an environment-wide change during review. The opt-in is not limited to the upload endpoint that prompted it. Include the owners of other request handlers in the rollout decision, even when their forms only send small payloads.

Why does middleware need special attention?

Vercel says opted-in Routing Middleware receives headers and metadata but no body. The announcement describes this as avoiding duplicate body transfer to middleware and the destination function. It also notes that Next.js applications using the Edge path need a Node.js runtime path, referring to runtime: 'nodejs' or proxy.ts as applicable. Runtime and middleware details

Before changing anything, search your application for code that reads a body in middleware. Then identify the purpose of each read: routing, signature verification, filtering or another decision. Review the correct execution point for that behavior with the application’s framework and integration requirements.

Do not simply delete a check so an upload starts working. If a security decision moves into a handler, verify that every relevant route reaches that check before processing or storing data. Keep a written description of the intended boundary so a later refactor does not accidentally bypass it.

A practical upload test plan

Use synthetic files in a staging environment. Give each test an expected user-visible outcome before running it.

Check What to observe
A normal small upload Existing forms still complete successfully.
A file above the old cap but below the new cap The server accepts it and the application finishes its intended work.
A request above the new cap The user gets a clear failure and can recover.
Multipart or encoded input Measure the complete request, including its wrapper.
An interrupted upload and retry No duplicate import or repeated side effect.
Several simultaneous uploads Memory, latency and error behavior stay within your operating targets.
An unrelated route Its middleware and authorization behavior still match expectations.

Vercel advises reading larger bodies promptly and processing smaller chunks where possible. Requests above the applicable platform cap return a 413 payload-too-large error. Handling larger requests

Measure completion as well as acceptance. For a product import, compare the intended records with the resulting catalogue and its error report. For document intake, confirm that the correct account can retrieve the finished result and another account cannot.

Costs and limits to review before production

The required memory setting is part of the adoption decision. Compare a representative workload before and after the change, including failures and retries. Use the team’s actual usage and current plan information to estimate cost; this guide does not promise a fixed per-upload price.

Also keep payload size distinct from execution time and processing complexity. A compressed file can be small in transit and expensive to unpack. Apply your own validation and operating limits even when the platform accepts the request.

For large or frequent file transfers, compare a direct-to-storage design with the function-based approach. Choose based on processing needs, access control, recovery and measured cost, rather than assuming the larger cap makes one architecture universally better.

Get help reviewing an upload workflow

Through FindMilan’s website development service, I can help map the request path, review middleware dependencies and define a controlled rollout. Browse my engineering projects for examples of the systems I work on.

A useful starting brief includes the framework, current runtime, approximate request sizes and the exact failure users encounter. That makes it easier to decide whether this beta addresses the problem or whether the upload design needs a broader change.

Frequently asked questions

What should I test before production?

Test the upload result, unrelated routes, authorization, interrupted requests and retries. Confirm that users can recover from a failure without creating duplicate work.

Does the larger limit work on the Edge runtime?

No. Edge functions and Edge Routing Middleware retain the 4.5MB request-body limit.

What happens to middleware after opting in?

Routing Middleware still receives headers and metadata, but cannot access request bodies in that project environment. Audit body-dependent behavior before enabling the beta.

Does this also raise the response-body limit?

No. Vercel documents a 4.5MB response-body limit, with an exception for streamed responses.

FAQ

Frequently asked questions

What should I test before production?

Test the upload result, unrelated routes, authorization, interrupted requests and retries. Confirm that users can recover from a failure without creating duplicate work.

Does the larger limit work on the Edge runtime?

No. Edge functions and Edge Routing Middleware retain the 4.5MB request-body limit.

What happens to middleware after opting in?

Routing Middleware still receives headers and metadata, but cannot access request bodies in that project environment. Audit body-dependent behavior before enabling the beta.

Does this also raise the response-body limit?

No. Vercel documents a 4.5MB response-body limit, with an exception for streamed responses.

Need help with Website and backend development?

Turn the idea into a working system.