Error: request entity too large

后端 未结 21 3635
无人共我
无人共我 2020-11-22 06:36

I\'m receiving the following error with express:

Error: request entity too large
    at module.exports (/Users/michaeljames/Documents/Projects/Proj/mean/node         


        
21条回答
  •  逝去的感伤
    2020-11-22 07:10

    In my case it was not enough to add these lines :

    var bodyParser = require('body-parser');
    app.use(bodyParser.json({limit: '50mb'}));
    app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
    

    I tried adding the parameterLimit option on urlencoded function as the documentation says and error no longer appears.

    The parameterLimit option controls the maximum number of parameters that are allowed in the URL-encoded data. If a request contains more parameters than this value, a 413 will be returned to the client. Defaults to 1000.

    Try with this code:

    var bodyParser = require('body-parser');
    app.use(bodyParser.json({limit: "50mb"}));
    app.use(bodyParser.urlencoded({limit: "50mb", extended: true, parameterLimit:50000}));
    

提交回复
热议问题