How to solve - PayloadTooLargeError

Hi Node rode,

I am using lot of svg images in my project. When I try to added flow, I am getting below error,

PayloadTooLargeError: request entity too large
    at readStream (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\raw-body\index.js:156:17)
    at getRawBody (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\raw-body\index.js:109:12)
    at read (C:\Users\\AppData\Roaming\npm\node_modules\node-red\node_modules\body-parser\lib\read.js:79:3)
    at jsonParser (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\body-parser\lib\types\json.js:135:5)
    at Layer.handle [as handle_request] (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\index.js:328:13)
    at C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\index.js:286:9
    at Function.process_params (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\index.js:346:12)
    at next (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\index.js:280:10)
    at cors (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\cors\lib\index.js:188:7)
    at C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\cors\lib\index.js:224:17
    at originCallback (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\cors\lib\index.js:214:15)
    at C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\cors\lib\index.js:219:13
    at optionsCallback (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\cors\lib\index.js:199:9)
    at corsMiddleware (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\cors\lib\index.js:204:7)
    at Layer.handle [as handle_request] (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\index.js:328:13)
    at C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\index.js:286:9
    at Function.process_params (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\index.js:346:12)
    at next (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\index.js:280:10)
    at expressInit (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\middleware\init.js:40:5)
    at Layer.handle [as handle_request] (C:\Users\AppData\Roaming\npm\node_modules\node-red\node_modules\express\lib\router\layer.js:95:5)

Am I exceeded the node red project size ?.
Please provide your suggestion.

I'm confused.

In what manner are they being used?

Add a flow?

What do you mean by that?

Adding a flow is not the same as a payload is too big error.

@Trying_to_learn .

I am working on a beer brewing project which has 8 tanks for various purposes. So, I need to use 8 SVG images to display the content of the tank and control the valves of each tank

Errrrr..
Ok.

Then I think there is a fundamental problem with what you are doing.
Or wanting to do.

Why do you specifically need to use those images?
the dashboard has a gauge node that can do fill amounts that have inbuilt animation amounts.

As SVG is supposed to be designed for this sort of stuff there shouldn't be a problem.
However: I don't know the full story.

Maybe not the best example, but o offer an alternative:

Ok.. Thanks for the info. .
After update new svg file to my each tank, I am getting this error.
With old svg file, I am not getting any error.
The delta between new and old svg file, addition of colors and some graphcis.

If the old ones work and the new ones don't: I'd check there isn't/aren't any problem with the files.

They are picture files - yes?

I am low on the knowledge ladder.

Even lower on the SVG knowledge ladder. In fact I don't even think I am on that ladder.
I'm not the right person to give help on that part.

It is always worth searching the forum when you get such problems, particularly when you can search for an unusual string such as payloadtoolargeerror.
This may be helpful. If not then look at the other hits in the search.

@Colin. .. Thanks for the info.

Even I have increased the size of apiMaxLength like this,

apiMaxLength: '50mb',

Still observing same error, PayloadTooLargeError: request entity too large.
After making changes in settings.js, do I need to restart my PC to reflect the changes in the project ?.

You will need to restart node-red.

If a restart doesn't fix it then post the output you see when you start node red (with the Welcome to node red message) and post your settings.js file. The file is the one mentioned in the log.

@Colin... After restart, I am not observing the issue.

Thanks for your guidance.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.