0

We have this request error where we were not able to send the request in express server even though we set parameterLimit and bodyParser.

we have tried setting parameterLimit:50000000000000, but still the same issue

app.use(bodyParser.json({limit: '15360mb', type: 'application/json'}))
app.use(bodyParser.urlencoded({limit: '15360mb', extended: true, type: 'application/json', parameterLimit: 5000000}))

We use

Node:8.9.4
body-parser: '1.18.3'
express: '4.17.0'

1 Answers1

1

From docs:

request entity too large

This error will occur when the request body's size is larger than the "limit" option. The limit property will be set to the byte limit and the length property will be set to the request body's length. The status property is set to 413 and the type property is set to 'entity.too.large'.

limit

Controls the maximum request body size. If this is a number, then the value specifies the number of bytes; if it is a string, the value is passed to the bytes library for parsing. Defaults to '100kb'

So you've to increase the limit option. For example, for json, setting limit to 10 MB

bodyParser.json({ limit: '10mb' })
Community
  • 1
  • 1
1565986223
  • 5,222
  • 2
  • 10
  • 27
  • 1
    app.use( bodyParser.json({limit: '50mb'}) ); app.use(bodyParser.urlencoded({ limit: '50mb', extended: true, parameterLimit:50000 })); this worked for us thanks – karthik kannan B May 21 '19 at 10:49