0

So I've followed a few of the other questions however I can't upload files larger than 30 MB (trying to upload 250MB+)

payloadTooLargeError: request entity too large

I'm using AWS Elastic Beanstalk to run EC2 servers for me. Using MySQL databases.

My app.js file has this

  const bodyParser = require('body-parser');
  app.use(bodyParser.json({limit: '1500mb'}));
  app.use(bodyParser.urlencoded({limit: '1500mb', extended: true}));

I added the following to .platform/nginx/conf.d/upload_size.conf

proxy_buffers 4 12480M;
proxy_buffer_size 12480M;
proxy_busy_buffers_size 12480M;
client_body_buffer_size 12480M;
client_max_body_size 12480M;

Which did increase the filesize amount I could upload, but it seems anything larger than about 10 MB will display the following error in my Elastic Beanstalk log.

Jan 17 23:46:51 ip-172-31-43-187 web: at /var/app/current/app.js:181:47
Jan 17 23:46:51 ip-172-31-43-187 web: at Layer.handle [as handle_request] (/var/app/current/node_modules/express/lib/router/layer.js:95:5)
Jan 17 23:46:51 ip-172-31-43-187 web: at next (/var/app/current/node_modules/express/lib/router/route.js:144:13)
Jan 17 23:46:51 ip-172-31-43-187 web: at Route.dispatch (/var/app/current/node_modules/express/lib/router/route.js:114:3)
Jan 17 23:46:51 ip-172-31-43-187 web: at Layer.handle [as handle_request] (/var/app/current/node_modules/express/lib/router/layer.js:95:5)
Jan 17 23:46:51 ip-172-31-43-187 web: at /var/app/current/node_modules/express/lib/router/index.js:284:15
Jan 17 23:46:51 ip-172-31-43-187 web: at param (/var/app/current/node_modules/express/lib/router/index.js:365:14)
Jan 17 23:46:51 ip-172-31-43-187 web: at param (/var/app/current/node_modules/express/lib/router/index.js:376:14)
Jan 17 23:46:51 ip-172-31-43-187 web: at param (/var/app/current/node_modules/express/lib/router/index.js:376:14)
Jan 18 00:00:12 ip-172-31-43-187 web: PayloadTooLargeError: request entity too large
Jan 18 00:00:12 ip-172-31-43-187 web: at readStream (/var/app/current/node_modules/raw-body/index.js:156:17)
Jan 18 00:00:12 ip-172-31-43-187 web: at getRawBody (/var/app/current/node_modules/raw-body/index.js:109:12)
Jan 18 00:00:12 ip-172-31-43-187 web: at read (/var/app/current/node_modules/body-parser/lib/read.js:79:3)
Jan 18 00:00:12 ip-172-31-43-187 web: at jsonParser (/var/app/current/node_modules/body-parser/lib/types/json.js:135:5)
Jan 18 00:00:12 ip-172-31-43-187 web: at Layer.handle [as handle_request] (/var/app/current/node_modules/express/lib/router/layer.js:95:5)
Jan 18 00:00:12 ip-172-31-43-187 web: at trim_prefix (/var/app/current/node_modules/express/lib/router/index.js:328:13)
Jan 18 00:00:12 ip-172-31-43-187 web: at /var/app/current/node_modules/express/lib/router/index.js:286:9
Jan 18 00:00:12 ip-172-31-43-187 web: at Function.process_params (/var/app/current/node_modules/express/lib/router/index.js:346:12)
Jan 18 00:00:12 ip-172-31-43-187 web: at next (/var/app/current/node_modules/express/lib/router/index.js:280:10)
Jan 18 00:00:12 ip-172-31-43-187 web: at expressInit (/var/app/current/node_modules/express/lib/middleware/init.js:40:5)
Jan 18 00:05:43 ip-172-31-43-187 web: PayloadTooLargeError: request entity too large
Jan 18 00:05:43 ip-172-31-43-187 web: at readStream (/var/app/current/node_modules/raw-body/index.js:156:17)
Jan 18 00:05:43 ip-172-31-43-187 web: at getRawBody (/var/app/current/node_modules/raw-body/index.js:109:12)
Jan 18 00:05:43 ip-172-31-43-187 web: at read (/var/app/current/node_modules/body-parser/lib/read.js:79:3)
Jan 18 00:05:43 ip-172-31-43-187 web: at jsonParser (/var/app/current/node_modules/body-parser/lib/types/json.js:135:5)
Jan 18 00:05:43 ip-172-31-43-187 web: at Layer.handle [as handle_request] (/var/app/current/node_modules/express/lib/router/layer.js:95:5)
Jan 18 00:05:43 ip-172-31-43-187 web: at trim_prefix (/var/app/current/node_modules/express/lib/router/index.js:328:13)
Jan 18 00:05:43 ip-172-31-43-187 web: at /var/app/current/node_modules/express/lib/router/index.js:286:9
Jan 18 00:05:43 ip-172-31-43-187 web: at Function.process_params (/var/app/current/node_modules/express/lib/router/index.js:346:12)
Jan 18 00:05:43 ip-172-31-43-187 web: at next (/var/app/current/node_modules/express/lib/router/index.js:280:10)
Jan 18 00:05:43 ip-172-31-43-187 web: at expressInit (/var/app/current/node_modules/express/lib/middleware/init.js:40:5)
Jan 18 00:23:34 ip-172-31-43-187 web: TypeError: next is not a function

Anybody have any ideas on what it might be? I have a feeling it's an AWS setting somewhere

Trevor Wood
  • 2,347
  • 5
  • 31
  • 56
  • Looks more related to the nodejs express config, can you check this one https://stackoverflow.com/questions/19917401/error-request-entity-too-large – Vikram S Jan 18 '23 at 06:12

0 Answers0