Error: request entity too large

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

    After דo many tries I got my solution

    I have commented this line

    app.use(bodyParser.json());
    

    and I put

    app.use(bodyParser.json({limit: '50mb'}))
    

    Then it works

    0 讨论(0)
  • 2020-11-22 07:16

    I too faced that issue, I was making a silly mistake by repeating the app.use(bodyParser.json()) like below:

    app.use(bodyParser.json())
    app.use(bodyParser.json({ limit: '50mb' }))
    

    by removing app.use(bodyParser.json()), solved the problem.

    0 讨论(0)
  • 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 }));
    
    0 讨论(0)
提交回复
热议问题