Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sails.js bodyParser - request entity too large on version 0.10.5

I am trying to post a lot of data to my sails API and I get this 413 error:

Unable to parse HTTP body- error occurred - Error: request entity too large

I have tried a lot of solutions suggested in differents discussions but it never works and seems to be for previous sails version. (it’s always about changing the bodyParser options)

Does anybody know the correct syntax for sails 0.10.5? Thanks a lot!

like image 656
sheoak Avatar asked Mar 17 '23 01:03

sheoak


1 Answers

Does anybody know the correct syntax for sails 0.10.5? Thanks a lot!

Take a look at this resolution (sails v.0.11.0, config/http.js):

module.exports.http = {

  middleware: { ... },

  bodyParser: function(){
    var opts = {
      limit:'10mb'
    }
   return require('./../node_modules/sails/node_modules/skipper')(opts);
  }
}
like image 52
tsv.titan Avatar answered Apr 29 '23 06:04

tsv.titan