Thursday, 5 November 2015

Error: request entity too large




Error: request entity too large
    at makeError (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/body-parser/node_modules/raw-body/index.js:184:15)
    at module.exports (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/body-parser/node_modules/raw-body/index.js:40:15)
    at read (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/body-parser/lib/read.js:65:3)
    at Layer.jsonParser [as handle] (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/body-parser/lib/types/json.js:83:5)
    at trim_prefix (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:226:17)
    at c (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:198:9)
    at Function.proto.process_params (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:251:12)
    at next (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:189:19)
    at Layer.urlencodedParser [as handle] (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/body-parser/lib/types/urlencoded.js:70:36)
    at trim_prefix (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:226:17)
    at c (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:198:9)
    at Function.proto.process_params (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:251:12)
    at next (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:189:19)
    at Layer.compression [as handle] (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/compression/index.js:216:5)
    at trim_prefix (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:226:17)

    at c (/Users/peterwang/Documents/dev/code/app-clinic-web/node_modules/express/lib/router/index.js:198:9)



I got this error because i try to push a big object to my API. That seems my object is too big for posting.

The solution is :

//peter added for Error: request entity too large  --start
var bodyParser = require('body-parser');
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
//peter added for Error: request entity too large  --end






http://stackoverflow.com/questions/29939852/mean-io-error-request-entity-too-large-how-to-increase-bodyparser-limit-ou
http://stackoverflow.com/questions/19917401/node-js-express-request-entity-too-large






No comments:

Post a comment