Error: request entity too large

后端 未结 21 3158
无人共我
无人共我 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:17

    If you are using express.json() and bodyParser together it will give error as express sets its own limit.

    app.use(express.json());
    app.use(express.urlencoded({ extended: false }));
    

    remove above code and just add below code

    app.use(bodyParser.json({ limit: "200mb" }));
    app.use(bodyParser.urlencoded({ limit: "200mb",  extended: true, parameterLimit: 1000000 }));
    

提交回复
热议问题