# Deploy failed - PayloadTooLargeError: request entity too large

**URL:** <https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202>\
**Category:** General\
**Created:** [5 May 2021 08:30 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202 "2021-05-05T08:30:45Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![scouike](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scouike](https://discourse.nodered.org/u/scouike)\
**Post date:** [5 May 2021 08:30 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/1 "2021-05-05T08:30:45Z")

</div>

Hi !

 ![error](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/6/665110e543d475904957e3b04c66f4e6f5a6f626.png)

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

```auto
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)

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 May 2021 09:36 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/2 "2021-05-05T09:36:52Z")

</div>

my guess is your flow file is larger than 5mb

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](https://github.com/node-red/node-red/blob/db0ff748576212d32ab46b47b560126ffa57f4e2/packages/node_modules/%40node-red/editor-api/lib/index.js#L69) 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...

```auto
    // 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

---

<div class="post-metadata">

**Author:** ![scouike](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scouike](https://discourse.nodered.org/u/scouike)\
**Post date:** [5 May 2021 09:45 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/3 "2021-05-05T09:45:30Z")

</div>

> [@Steve-Mcl](#):
>
> 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...

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 🙄

---

<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:** [5 May 2021 10:05 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/4 "2021-05-05T10:05:09Z")

</div>

> [@scouike](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![scouike](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scouike](https://discourse.nodered.org/u/scouike)\
**Post date:** [5 May 2021 11:25 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/5 "2021-05-05T11:25:37Z")

</div>

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](https://nodered.org/docs/user-guide/runtime/embedding) but I don't understand everything...

 ![package.json](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e7f765d101fe8154c587c0385e1442450d846176.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 May 2021 11:40 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/6 "2021-05-05T11:40:44Z")

</div>

try creating a settings.js file in that folder.

put inside...

```auto
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?

---

<div class="post-metadata">

**Author:** ![scouike](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scouike](https://discourse.nodered.org/u/scouike)\
**Post date:** [5 May 2021 11:51 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/7 "2021-05-05T11:51:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scouike](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scouike](https://discourse.nodered.org/u/scouike)\
**Post date:** [5 May 2021 12:12 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/8 "2021-05-05T12:12:53Z")

</div>

Well... it doesn't work, I feel like I've covered everything and there are no solutions. 😪

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 May 2021 12:14 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/9 "2021-05-05T12:14:51Z")

</div>

There is a sledgehammer approach...

Edit the src file and set the value explicitly.

---

<div class="post-metadata">

**Author:** ![scouike](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scouike](https://discourse.nodered.org/u/scouike)\
**Post date:** [5 May 2021 12:43 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/10 "2021-05-05T12:43:48Z")

</div>

I think I don't search at the in the right place.  
What is the right path for the `settings.js` ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 May 2021 12:47 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/11 "2021-05-05T12:47:09Z")

</div>

If there isn't already a settings.js file alongside the flow files, it means your node-red instance is either:

1. being run with the `-s` option to point at the settings.js file in some unknown (to us) location
2. being run in embedded mode where some custom code on your device is providing the settings programmatically.

What is this device? Is it something you've setup yourself or is it a commercial product? Do have any access to the Node-RED log output?

---

<div class="post-metadata">

**Author:** ![scouike](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scouike](https://discourse.nodered.org/u/scouike)\
**Post date:** [5 May 2021 12:52 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/12 "2021-05-05T12:52:18Z")

</div>

My device is a Sierra Wireless FX30 3G and it is preconfigured.

---

<div class="post-metadata">

**Author:** ![scouike](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scouike](https://discourse.nodered.org/u/scouike)\
**Post date:** [5 May 2021 13:09 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/13 "2021-05-05T13:09:03Z")

</div>

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

---

<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:** [4 July 2021 13:09 UTC](https://discourse.nodered.org/t/deploy-failed-payloadtoolargeerror-request-entity-too-large/45202/14 "2021-07-04T13:09:16Z")

</div>

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