question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serverless "Body exceeded 1mb limit"

See original GitHub issue

Bug 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

image

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:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

22reactions
jose-donatocommented, Nov 30, 2020

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 image

6reactions
Joseppi83commented, Jun 2, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found