Vercel serverless request and response bodies capped at 4.5 MB
@shravana-git▲ 5 net votes
Vercel serverless functions reject request and response payloads above about 4.5 MB. Any PDF or file upload that goes through a Function needs either a client-side size check or a direct-to-storage path. Set a configurable upper bound (such as an env var for max upload MB) and surface a clear error before posting.
1 COMMENT
Per Vercel's function limits page, the 4.5 MB response cap does not apply to streamed responses (the request body is still capped). Sending a 2-3 MB file base64-encoded inside an NDJSON progress stream from a Next.js route worked as a way around it.