When I want to deploy my flow I have this error. I think it's because my flow is too important.
Do you have a solution ?
Ty by advance
Deploy failed:
PayloadTooLargeError: request entity too large
at readStream (/usr/share/myapp/nodejs/node_modules/raw-body/index.js:155:17)
at getRawBody (/usr/share/myapp/nodejs/node_modules/raw-body/index.js:108:12)
at read (/usr/share/myapp/nodejs/node_modules/body-parser/lib/read.js:77:3)
at jsonParser (/usr/share/myapp/nodejs/node_modules/body-parser/lib/types/json.js:135:5)
at Layer.handle [as handle_request] (/usr/share/myapp/nodejs/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/usr/share/myapp/nodejs/node_modules/express/lib/router/index.js:317:13)
at /usr/share/myapp/nodejs/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/share/myapp/nodejs/node_modules/express/lib/router/index.js:335:12)
at next (/usr/share/myapp/nodejs/node_modules/express/lib/router/index.js:275:10)
at urlencodedParser (/usr/share/myapp/nodejs/node_modules/body-parser/lib/types/urlencoded.js:100:7)
at Layer.handle [as handle_request] (/usr/share/myapp/nodejs/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/usr/share/myapp/nodejs/node_modules/express/lib/router/index.js:317:13)
at /usr/share/myapp/nodejs/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/share/myapp/nodejs/node_modules/express/lib/router/index.js:335:12)
at next (/usr/share/myapp/nodejs/node_modules/express/lib/router/index.js:275:10)
at serveStatic (/usr/share/myapp/nodejs/node_modules/serve-static/index.js:75:16)
The error "PayloadTooLargeError: request entity too large" occurs when the express bodyParser tries to process JSON (flow) larger than the set limit.
It is set at 5mb by default - see this line in the node-red src
Are you storing lots of base64 images in your flow? or is it just soooo large and complex?
The best solution is to see if you can tidy up your flows.
Alternatively: if you cannot reduce your flow file size, then you could increase the limit by setting apiMaxLength to something like "8mb" in your settings.js file - e.g...
// The maximum size of HTTP request that will be accepted by the runtime api.
// Default: 5mb
apiMaxLength: '8mb', /////// <<<<<<< uncomment & update this line
NOTE: you will need to restart node-red for it to take effect
Yes that the probleme, I can't reduce my flow so I search the "settings.js" and I don't find it...
But thank you for confirming that my lead is the right one!
I go back to hunting for the "settings.js" file
It is in the same place as your flows file. Usually .node-red in your home folder, unless you have installed using Docker or another container. But I assume you know where your flows file is, otherwise how would you be backing it up?
If you start node-red in a terminal it will tell you where it is.
It's a bit more complicated. My Node-Red is embedded in a GSM module so it seems to me that the settings.js file does not exist.
And the stream files are saved directly on the module.
Node-Red starts from a tab on the localhost page of my module.
But I have the package.json and I found some information on this link https://nodered.org/docs/user-guide/runtime/embedding but I don't understand everything...
console.log("Hello from settings.js");
module.exports = {
// The maximum size of HTTP request that will be accepted by the runtime api.
// Default: 5mb
apiMaxLength: '6mb',
}
NOTE: I think your node-red version will need to be >= 0.20.0 - what version is on that box?
Yes I found the file settings.js in the user guide of Node-Red so I try this and I'm keeping my fingers crossed that it work
PS : My node-red version is V1.1.0
Well ! I found settings.js, it was very well hidden... BUT I can't modified it because I don't have the permission... I don't understand, i'm login in admin