Serverless "Body exceeded 1mb limit"
See original GitHub issueBug report
Describe the bug
When sending FormData larger than 1MB in the body of POST request to /api serverless function I’m getting “Body exceeded 1mb limit”.
To Reproduce
const formData = new FormData();
formData.append("image", file) //file is an image with more than 1MB
fetch("/api/dominantColor", {
method: "POST",
body: formData
})
Expected behavior
We should be able to send data with more than 1mb.
Screenshots
System information
- OS: WSL2 ubuntu 20.10
- Browser (if applies) Chrome
- Version of Next.js: 10.0.1
- Version of Node.js: v12.19.0
- Deployment: next dev
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Body exceeded 1mb limit error in Next.js API route
The default size limit for the body parser is 1mb in API routes. You can modify this value through the custom config object...
Read more >API Routes Response Size Limited to 4MB - Next.js
API Routes are meant to respond quickly and are not intended to support responding with large amounts of data. The maximum size of...
Read more >Body Size is Too Large Error, but Body Size is Under Limit
The response body size is 5622338 bytes (5.36 MB). This is how I am calculating the response size (python 2.7): out = {}...
Read more >Lambda quotas - AWS Documentation
Maximum sizes, limits, and quotas for Lambda functions and API requests. ... In other words, the total invocation limit is 10 times your...
Read more >Deep Dive: Lambda's Response Payload Size Limit (1/2)
The limit in question is listed on the Lambda quotas page as “Invocation payload (request and response)” and says it's 6 MB for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My bad, sorry. I did not see the part where this is stated in the documentation.
https://nextjs.org/docs/api-routes/api-middlewares#custom-config
Thanks for posting when and why you found the answer to your problem! You saved me some time, because I was scratching my head, when I saw the “1mb limit” notice in the console.