# PayloadTooLargeError at deploy

**URL:** https://discourse.nodered.org/t/payloadtoolargeerror-at-deploy/67053
**Category:** General
**Created:** [29 August 2022 05:25 UTC](https://discourse.nodered.org/t/payloadtoolargeerror-at-deploy/67053 "2022-08-29T05:25:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![skipware](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@skipware](https://discourse.nodered.org/u/skipware)
#### Post date: [29 August 2022 05:25 UTC](https://discourse.nodered.org/t/payloadtoolargeerror-at-deploy/67053/1 "2022-08-29T05:25:32Z")

</div>

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.  
 ![PayloadTooLargeError](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/0/9084d3351e488371ccb69bf0d1e1045ddf7f2e02.jpeg)

The post seems to refer nicely:

> **[How to fix the request entity too large error in Express](https://reactgo.com/request-entity-too-large-node/)**
>
> In this tutorial, we will learn about how to resolve the request entity too large error in express. In express, we use the middleware to…

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?

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

```

---

<div class="post-metadata">

### Author: ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)
#### Post date: [29 August 2022 12:11 UTC](https://discourse.nodered.org/t/payloadtoolargeerror-at-deploy/67053/2 "2022-08-29T12:11:32Z")

</div>

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

**[EDIT]**

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

---

<div class="post-metadata">

### Author: ![skipware](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@skipware](https://discourse.nodered.org/u/skipware)
#### Post date: [30 August 2022 00:56 UTC](https://discourse.nodered.org/t/payloadtoolargeerror-at-deploy/67053/3 "2022-08-30T00:56:01Z")

</div>

@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?

---

<div class="post-metadata">

### Author: ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)
#### Post date: [30 August 2022 01:53 UTC](https://discourse.nodered.org/t/payloadtoolargeerror-at-deploy/67053/4 "2022-08-30T01:53:23Z")

</div>

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](https://nodered.org/docs/user-guide/runtime/settings-file)

---

<div class="post-metadata">

### Author: ![skipware](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@skipware](https://discourse.nodered.org/u/skipware)
#### Post date: [31 August 2022 05:45 UTC](https://discourse.nodered.org/t/payloadtoolargeerror-at-deploy/67053/5 "2022-08-31T05:45:05Z")

</div>

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.  
Skipware

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [14 September 2022 05:45 UTC](https://discourse.nodered.org/t/payloadtoolargeerror-at-deploy/67053/6 "2022-09-14T05:45:13Z")

</div>

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