Request Entity Too Large Error NodeJS/NestJS

Request Entity too large error

Request Entity Too Large: You send a large payload to nodejs/nestjs API and the backend throws an error Request entity too large. This error usually happens when you send a large payload to the server which is beyond the default payload accepted limit of the server. Though you should not be sending such a huge payload to the server and avoid any such scenario where your entity size is greater than the default server limit.

But at times you are in a position where you need to parse a large entity set in frontend and pass it back to backend. For these scenarios you can set the configurations mentioned below to skip the error of Request entity size too large in your nodejs and nestjs code.

app.use(express.json({limit: '50mb'}));
app.use(express.urlencoded({limit: '50mb'}));

You can set limit size and in body parser object to bypass the large entity size error.

If this solution doesn’t work for you, you can try few of the solutions mentioned in the stack overflow article Error: request Entity too large.

Checkout our previous posts.

Happy coding!!

Request Entity Too Large Error NodeJS/NestJS

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top