Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

increase the limit of request for form-data in express.js

I am using Express and sending request as FORM-DATA

ERROR -

PayloadTooLargeError: request entity too large
at readStream (e:\MindfulSAS\myGit\hereiam-api\node_modules\raw-body\index.js:155:17)
at getRawBody (e:\MindfulSAS\myGit\hereiam-api\node_modules\raw-body\index.js:108:12)
at read (e:\MindfulSAS\myGit\hereiam-api\node_modules\body-parser\lib\read.js:77:3)
at jsonParser (e:\MindfulSAS\myGit\hereiam-api\node_modules\body-parser\lib\types\json.js:134:5)
at Layer.handle [as handle_request] (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:317:13)
at e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:284:7
at Function.process_params (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:335:12)
at next (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:275:10)
at expressInit (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\middleware\init.js:40:5)
at Layer.handle [as handle_request] (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:317:13)
at e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:284:7
at Function.process_params (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:335:12)
at next (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:275:10)
at query (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\middleware\query.js:45:5)
at Layer.handle [as handle_request] (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:317:13)
at e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:284:7
at Function.process_params (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:335:12)
at next (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:275:10)
at Function.handle (e:\MindfulSAS\myGit\hereiam-api\node_modules\express\lib\router\index.js:174:3)

is their any way to increase the limit of request for form-data ?

like image 418
cop Avatar asked Dec 12 '25 09:12

cop


1 Answers

I think below may help you

var app = express();
app.use(bodyParser.urlencoded({limit: '50mb', extended: false}));
app.use(bodyParser.json({limit: '50mb'}));
like image 142
shivshankar Avatar answered Dec 15 '25 18:12

shivshankar