Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http node cannot handle large files in post request #21

Open
adasilva70 opened this issue Jan 30, 2018 · 0 comments
Open

http node cannot handle large files in post request #21

adasilva70 opened this issue Jan 30, 2018 · 0 comments

Comments

@adasilva70
Copy link

This issue was originally reported by Bluemix customer via a support case.

http node cannot handle large files (it works fine in the non-Bluemix version of node-red).
I created a very simple flow:

  • http input node configured for POST and accepting files
  • empty function node
  • http response

then I tried to post a large file using curl:

curl -d "@failreq.json" -X POST http://adasilva-node-red.mybluemix.net/test

The file has about 220kb. I cloned this repo and tried to change the index.js file adding the following code:

 var maxApiRequestSize = settings.apiMaxLength || '5mb';
 app.use(bodyParser.json({limit:maxApiRequestSize}));
 app.use(bodyParser.urlencoded({limit:maxApiRequestSize,extended:true}));

but it did not help. Here is the error I am seeing:

2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT 30 Jan 23:00:55 - [warn] [http in:355828e2.d32798] Error: request entity too large
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at readStream (/home/vcap/app/node_modules/node-red/node_modules/raw-body/index.js:196:17)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at getRawBody (/home/vcap/app/node_modules/node-red/node_modules/raw-body/index.js:106:12)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at read (/home/vcap/app/node_modules/node-red/node_modules/body-parser/lib/read.js:76:3)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at urlencodedParser (/home/vcap/app/node_modules/node-red/node_modules/body-parser/lib/types/urlencoded.js:115:5)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at metricsHandler (/home/vcap/app/node_modules/node-red/nodes/core/io/21-httpin.js:215:59)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at httpMiddleware (/home/vcap/app/node_modules/node-red/nodes/core/io/21-httpin.js:207:59)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at cookieParser (/home/vcap/app/node_modules/cookie-parser/index.js:56:14)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/route.js:137:13)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at Route.dispatch (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/route.js:112:3)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at /home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:281:22
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at Function.process_params (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:335:12)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at next (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/index.js:275:10)
   2018-01-30T18:00:55.78-0500 [APP/PROC/WEB/0] OUT     at Layer.handle [as handle_request] (/home/vcap/app/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant