# HTTP 413 with a 1.29KB POST?

**URL:** <https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036>\
**Category:** General\
**Created:** [12 March 2020 16:04 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036 "2020-03-12T16:04:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliv3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/oliv3/32/7193_2.png) [@oliv3](https://discourse.nodered.org/u/oliv3)\
**Post date:** [12 March 2020 16:04 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036/1 "2020-03-12T16:04:04Z")

</div>

I have an Http In node which fails to accept a 1.29KB POST resulting with this error:

PayloadTooLargeError: too many parameters  
at queryparse (/usr/src/node-red/node\_modules/body-parser/lib/types/urlencoded.js:151:13)  
at parse (/usr/src/node-red/node\_modules/body-parser/lib/types/urlencoded.js:75:9)  
at /usr/src/node-red/node\_modules/body-parser/lib/read.js:121:18  
at invokeCallback (/usr/src/node-red/node\_modules/raw-body/index.js:224:16)  
at done (/usr/src/node-red/node\_modules/raw-body/index.js:213:7)  
at IncomingMessage.onEnd (/usr/src/node-red/node\_modules/raw-body/index.js:273:7)  
at IncomingMessage.emit (events.js:203:15)  
at endReadableNT (\_stream\_readable.js:1145:12)  
at process.\_tickCallback (internal/process/next\_tick.js:63:19)

It' 1.0.4, but it used to work with pre-1.0 versions, so I'm stumped 🙂

---

<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:** [12 March 2020 16:10 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036/2 "2020-03-12T16:10:39Z")

</div>

> [@oliv3](#):
>
> PayloadTooLargeError: too many parameter

This means you are sending over 1000 parameters as part of the post request - which does seem quite excessive.

Between pre-1.0 and 1.0 we would have upgraded the various modules that handle the incoming requests. I can only assume something in there has changed its behaviour in this area.

The module in question does allow this limit to be changed - but we don't expose it in any meaningful way: [body-parser/README.md at master · expressjs/body-parser · GitHub](https://github.com/expressjs/body-parser/blob/master/README.md#parameterlimit)

Are you able to change it to send them as the body of the POST rather than query params?

---

<div class="post-metadata">

**Author:** ![oliv3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/oliv3/32/7193_2.png) [@oliv3](https://discourse.nodered.org/u/oliv3)\
**Post date:** [12 March 2020 16:17 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036/3 "2020-03-12T16:17:51Z")

</div>

The post is made like this:

```
    $.ajax({
            url: url,
            type: "POST",
            dataType: "json",
            data: {
	    action: "upload",
	    data: some_array,
	    year: year,
	    month: month,
	    day: day,
	    uid: uid,
	    gid: gid,
	    sid: sid
            },
	success: function(data, textStatus, jqXHR) {
	    alert("OK");
	}});
```

---

<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:** [12 March 2020 16:24 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036/4 "2020-03-12T16:24:58Z")

</div>

At some point you may have to read the jquery api docs for yourself to figure this out...

Maybe try:

```auto
$.ajax({
            url: url,
            type: "POST",
            dataType: "json",
            data: JSON.stringify({
  	    action: "upload",
	    data: some_array,
	    year: year,
	    month: month,
	    day: day,
	    uid: uid,
	    gid: gid,
	    sid: sid
            }),
	success: function(data, textStatus, jqXHR) {
	    alert("OK");
	}});
```

---

<div class="post-metadata">

**Author:** ![oliv3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/oliv3/32/7193_2.png) [@oliv3](https://discourse.nodered.org/u/oliv3)\
**Post date:** [12 March 2020 16:47 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036/5 "2020-03-12T16:47:58Z")

</div>

Well from [https://api.jquery.com/jQuery.ajax/](https://api.jquery.com/jQuery.ajax/) "data" can be a "PlainObject"  
And it works now with first "data" as an object and second data = JSON.stringify(some\_array)

---

<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:** [12 March 2020 16:51 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036/6 "2020-03-12T16:51:08Z")

</div>

Or, from the same page, you could add:

```auto
contentType: "application/json"

```

which tells it to send the data as JSON encoded data in the body, rather than its default behaviour of encoding as query params.

---

<div class="post-metadata">

**Author:** ![oliv3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/oliv3/32/7193_2.png) [@oliv3](https://discourse.nodered.org/u/oliv3)\
**Post date:** [12 March 2020 16:54 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036/7 "2020-03-12T16:54:38Z")

</div>

Well I'm pretty sure it used to work like this 🙂... Pre-1.0.

---

<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:** [11 May 2020 16:54 UTC](https://discourse.nodered.org/t/http-413-with-a-1-29kb-post/23036/8 "2020-05-11T16:54:39Z")

</div>

Closed on 11 May 2020 16:54 UTC

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