# Error when deploying - PayloadTooLargeError: request entity too large

**URL:** <https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224>\
**Category:** General\
**Created:** [30 September 2025 11:31 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224 "2025-09-30T11:31:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [30 September 2025 11:31 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/1 "2025-09-30T11:31:01Z")

</div>

I just copied a flow of around 300 nodes to a new tab to start working on some changes, but cannot deploy (any type of deploy) due to the following error. Any ideas for possible debugging ?

```auto
PayloadTooLargeError: request entity too large
    at readStream (/usr/lib/node_modules/node-red/node_modules/body-parser/node_modules/raw-body/index.js:163:17)
    at getRawBody (/usr/lib/node_modules/node-red/node_modules/body-parser/node_modules/raw-body/index.js:116:12)
    at read (/usr/lib/node_modules/node-red/node_modules/body-parser/lib/read.js:79:3)
    at jsonParser (/usr/lib/node_modules/node-red/node_modules/body-parser/lib/types/json.js:138:5)
    at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:328:13)
    at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:346:12)
    at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:280:10)
    at cors (/usr/lib/node_modules/node-red/node_modules/cors/lib/index.js:188:7)
    at /usr/lib/node_modules/node-red/node_modules/cors/lib/index.js:224:17
    at originCallback (/usr/lib/node_modules/node-red/node_modules/cors/lib/index.js:214:15)
    at /usr/lib/node_modules/node-red/node_modules/cors/lib/index.js:219:13
    at optionsCallback (/usr/lib/node_modules/node-red/node_modules/cors/lib/index.js:199:9)
    at corsMiddleware (/usr/lib/node_modules/node-red/node_modules/cors/lib/index.js:204:7)
    at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:328:13)
    at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:346:12)
    at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:280:10)
    at expressInit (/usr/lib/node_modules/node-red/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:328:13)
    at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:346:12)
    at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:280:10)
    at query (/usr/lib/node_modules/node-red/node_modules/express/lib/middleware/query.js:45:5)
    at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)

```

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [30 September 2025 11:38 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/2 "2025-09-30T11:38:37Z")

</div>

Dunno, perhaps this in the settings:

```auto
    /** The maximum size of HTTP request that will be accepted by the runtime api.
     * Default: 5mb
     */
    apiMaxLength: '100mb',

```

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [30 September 2025 11:39 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/3 "2025-09-30T11:39:28Z")

</div>

you can try increasing `apiMaxLength` in **settings.js**

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [30 September 2025 11:41 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/4 "2025-09-30T11:41:23Z")

</div>

> [@omrid](#):
>
> increasing `apiMaxLength` in

great minds and all that ... 😉

Had a look through my settings and found nothing else that might be appropriate - there is a debug limit but that's not what matters.

I vaguely remembering having the same/similar issue and setting the apiMaxLength to fix it ...

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [30 September 2025 11:44 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/5 "2025-09-30T11:44:58Z")

</div>

> [@gregorius](#):
>
> `apiMaxLength: '100mb'`

Thanks that did the trick, I'm surprised I have not had this issue before, but you live and learn 😉  
I set it to 15mb not sure what implications there are if it is "too" big ?

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [30 September 2025 11:45 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/6 "2025-09-30T11:45:45Z")

</div>

> [@gregorius](#):
>
> great minds and all that ... 😉

You beat me to it 😄

There is another msg size parameter, `maxHttpBufferSize`, which is specific to dashboard-2, determining the the max size of messages coming from dashboard widgets

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [30 September 2025 11:49 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/7 "2025-09-30T11:49:22Z")

</div>

Thanks again both, but as @gregorius exceeded the expected KPI, he gets the tick 🤣

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [30 September 2025 11:56 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/8 "2025-09-30T11:56:46Z")

</div>

> [@Sean-McG](#):
>
> not sure what implications there are if it is "too" big

I use a limit of 100MB, and never had an issue except that it takes time to load or deploy flows.

Instead of increasing the message size limit, I would try to reduce the flow size (which will also make it more maintainable). For example, use link-call groups instead of subflows (subflows are actually "macros" which get replicated exponentially: 10 instances of a subflow of 20 nodes, create 200 nodes etc.)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 September 2025 12:01 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/9 "2025-09-30T12:01:26Z")

</div>

> [@gregorius](#):
>
> `The maximum size of HTTP request that will be accepted by the runtime api.`

It is a bit confusing calling it the runtime api, which tends to make one think it is the flows runtime rather than the admin api.

---

<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 October 2025 12:01 UTC](https://discourse.nodered.org/t/error-when-deploying-payloadtoolargeerror-request-entity-too-large/99224/10 "2025-10-14T12:01:36Z")

</div>

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