PayloadTooLargeError at deploy

This error is clearly related to the size of the flows within the instance since I can reduce the size of the flow file (by removing a node or 2 from the flow). I've attached a screen shot of the error.

The post seems to refer nicely:

The answer is to increase the limit in express, however no matter what I've tried setting httpServerOptions has no effect. I do note that express.json and express.urlencoded are methods

Is anyone able to provide the correct syntax to set these options within settings.js?

app.use(express.json({limit: '25mb'}));
app.use(express.urlencoded({limit: '25mb'}));

I havent used this option but from my settings.js file the default is commented out and is defined as an object. So im guessing

httpServerOptions: { limit: '25mb' },

no need for app.use or anything else .. i think it should apply for all middleware


I see there is also an option in settings for //apiMaxLength: '5mb',

The maximum size of HTTP request that will be accepted by the runtime api. Default: 5mb

@UnborN tried the httpServerOptions idea but it has no effect. I did also try to increase apiMaxLength to no avail. I think this one is for http request nodes.

Any other ideas? Is there somewhere I could possibly edit this in the express modules themselves?

sorry @skipware .. have no idea .. by reading some other posts apiMaxLength should have worked.

  1. silly question but you restarted node-red after each settings.js change ?
  2. you did confirm that the flow file is indeed larger than 5mb to eliminate it being some other issue
  3. made sure you edited the correct settings.js file

Hey @unborN,

Short Story: it is the apiMaxLength parameter in settings.js that fixes this issue. The httpServerOptions does nothing for this issue.

When testing I had increased the apiMaxLength to 10mb but had actually used so many nodes that the flows file was bigger than the new setting. The original size of the flows file ( .../.node-red/flows_.json was bordering on the default 5mb.

Thanks for the direction.

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