PayloadTooLargeError: request entity too large
Controlling the maximum request body size will do the trick, however, you do not need body-parser anymore. Instead of using body-parser middleware, use the new Express implementation:
app.use(express.json({limit: '50mb'}));
app.use(express.urlencoded({limit: '50mb', extended: true, parameterLimit: 50000}));
You can find here the complete documentation.
My issue was because I had app.use(express.json())
and also
app.use(bodyParser.json({ limit: "50mb" }))
and
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true, parameterLimit: 50000 }))
I solved it after removing app.use(express.json())
. Hope it helps somebody with the same issue.