watson-developer-cloud/assistant-simple

Error 413 (Payload Too Large) custom context variables

huesoamz opened this issue · 4 comments

We have a custom solution that send customs context variables to watson that we define on our custom backend, the problem its that the

This is the error:

PayloadTooLargeError: request entity too large<br> &nbsp; &nbsp;at readStream (/node_modules/body-parser/node_modules/raw-body/index.js:155:17)<br> &nbsp; &nbsp;at getRawBody (/node_modules/body-parser/node_modules/raw-body/index.js:108:12)<br> &nbsp; &nbsp;at read (/node_modules/body-parser/lib/read.js:77:3)<br> &nbsp; &nbsp;at jsonParser (/node_modules/body-parser/lib/types/json.js:134:5)<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)<br> &nbsp; &nbsp;at trim_prefix (/node_modules/express/lib/router/index.js:317:13)<br> &nbsp; &nbsp;at /node_modules/express/lib/router/index.js:284:7<br> &nbsp; &nbsp;at Function.process_params (/node_modules/express/lib/router/index.js:335:12)<br> &nbsp; &nbsp;at next (/node_modules/express/lib/router/index.js:275:10)<br> &nbsp; &nbsp;at serveStatic (/node_modules/express/node_modules/serve-static/index.js:75:16)</pre>

What could be the correct solution? increse the limit on the body parser, like this?:

app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));

We are using the app.js by default without setting any limit

@stevenpkg Can you advise.

I do not have an answer for you, you will need to debug your own code, as this space is only for issues with demo code

@huesoamz you need to increase the payload as you suggested above. I think the demo uses the default value which is 1mb.

I'm closing this since it's not a problem with this demo