In my work we use express nodejs to create mock. During performance tests we noticed that for request around 2 MB nodejs throw error ->
PayloadTooLargeError: request entity too large
at readStream (c:\Work\mocks\Mocks\tst\ver01\node_modules\raw-body\index.js:155:17)
at getRawBody (c:\Work\mocks\Mocks\tst\ver01\node_modules\raw-body\index.js:108:12)
at read (c:\Work\mocks\Mocks\tst\ver01\node_modules\body-parser\lib\read.js:77:3)
at jsonParser (c:\Work\mocks\Mocks\tst\ver01\node_modules\body-parser\lib\types \json.js:135:5)
at Layer.handle [as handle_request] (c:\Work\mocks\Mocks\tst\ver01\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (c:\Work\mocks\Mocks\tst\ver01\node_modules\express\lib\router\index.js:317:13)
at c:\Work\mocks\Mocks\tst\ver01\node_modules\express\lib\router\index.js:284:7
at Function.process_params (c:\Work\mocks\Mocks\tst\ver01\node_modules\express\lib\router\index.js:335:12)
at next (c:\Work\mocks\Mocks\tst\ver01\node_modules\express\lib\router\index.js:275:10)
at expressInit (c:\Work\mocks\Mocks\tst\ver01\node_modules\express\lib\middleware\init.js:40:5)
According other instructions I applied the following solutions ->
app.use(bodyParser.json({limit: "50mb", extended: true, parameterLimit:50000}));
app.use(bodyParser.urlencoded({limit: "50mb", extended: true, parameterLimit:50000}));
and
app.post('/marked-parcels', bodyParser({limit: '10mb'}), (req, res) => SendEmptyResponse(res));
But these solutions dind't working. We checked out on other type of web service as .net core HttpListener. There is no problem with handle that request so we assume problem is in nodejs.
Could someone advice us how to handle that request in nodejs ? Maybe is one more solution which can help us. For all anserws thanks a lot.
Regards.