# Http request node returning error

**URL:** https://discourse.nodered.org/t/http-request-node-returning-error/71101
**Category:** General
**Created:** [23 November 2022 11:16 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101 "2022-11-23T11:16:51Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [23 November 2022 11:16 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/1 "2022-11-23T11:16:51Z")

</div>

A colleague sent me an example flow to obtain data from the Met Office Datahub, which worked fine.  
However, using that flow as a template, my version failed, and produced errors that say that the api structure is incorrect, despite the nodes being configure the same. After a lot of testing, I've isolated the problem down to the http request nodes (which again are configured identically).  
The request node imported from my colleague works, whilst mine from my palette does not 🤔

![met](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/050e22b9d9facc96f44d61d9c989b749fa1f5ce2.jpeg)

Obviously, I'm moving the link between the 2 http request nodes and deploying (to ensure that they are both getting exactly the same input)

The http request nodes are configured the same;

 ![works](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/a/aabb187fcad84038191518aa976d8ed9c3ae8880.jpeg)

 ![doesnt](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb86cd72bd54d3ba9748668f85cfecd93da25429.jpeg)

The first node produces a valid response, whilst the second has errors;

![errors](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/d/4d11cfb4f983bbcc4c300f137c4e10cc84657041.jpeg)

I can't forum share the flow as it contains my personal api key/secret, but could share to a team member via DM.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [23 November 2022 11:35 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/2 "2022-11-23T11:35:16Z")

</div>

are you injecting a decimal value (as the message suggests) ?

hmm if you just connect the wire from the first to the second node, yes that would be weird.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [23 November 2022 11:36 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/3 "2022-11-23T11:36:58Z")

</div>

> [@bakman2](#):
>
> are you injecting a decimal value

Yes.  
My point is that it works with one http request node, and not the other, despite them both being identically configured.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [23 November 2022 11:38 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/4 "2022-11-23T11:38:03Z")

</div>

Are you injecting them both at the same time (perhaps hitting API rate limitations?)

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [23 November 2022 11:42 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/5 "2022-11-23T11:42:05Z")

</div>

> [@bakman2](#):
>
> perhaps hitting API rate limitations?

I'm switching between the 2, and the responses are consistent.  
I'm should not be hitting API rate limitations.

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [23 November 2022 11:47 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/6 "2022-11-23T11:47:26Z")

</div>

Are you victim to an object reference changing shape, and being used again in the 2nd call 🤷‍♂️

Just a guess

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [23 November 2022 11:56 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/7 "2022-11-23T11:56:57Z")

</div>

Upon 2nd thoughts, not likely 😅  
Highlight each http request node and check the properties in the side bar.

---

<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: [23 November 2022 12:05 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/8 "2022-11-23T12:05:38Z")

</div>

> [@Paul-Reed](#):
>
> I can't forum share the flow as it contains my personal api key/secret

Is that in the inject node? If so then edit it to change the key and post the flow. Perhaps there is a subtle difference that does not show in the dialog.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [23 November 2022 12:13 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/9 "2022-11-23T12:13:43Z")

</div>

> [@Colin](#):
>
> Is that in the inject node?

No, they are in the change node.  
But here's a copy where they have been sanitized, which won't of course work.

```auto
[{"id":"fe89dd5d43b6ba32","type":"inject","z":"1543d308b342690a","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":2410,"wires":[["c8e007f9979e333b"]],"l":false},{"id":"c8e007f9979e333b","type":"change","z":"1543d308b342690a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"excludeParameterMetadata\":false,\"includeLocationName\":true,\"latitude\":52.4729210,\"longitude\":-1.0567790}","tot":"json"},{"t":"set","p":"headers","pt":"msg","to":"{\"accept\":\"application/json\",\"x-ibm-client-secret\":\"eb284bCXXXXXXXX3bc\",\"x-ibm-client-id\":\"5f6c295abXXXXXXXXXXXXXXc8b8\"}","tot":"json"},{"t":"set","p":"url","pt":"msg","to":"https://api-metoffice.apiconnect.ibmcloud.com/metoffice/production/v0/forecasts/point/hourly","tot":"str"},{"t":"set","p":"method","pt":"msg","to":"GET","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":2410,"wires":[["26566e0283a11c41"]],"l":false,"info":"[https://metoffice.apiconnect.ibmcloud.com/metoffice/production/api](https://metoffice.apiconnect.ibmcloud.com/metoffice/production/api)"},{"id":"26566e0283a11c41","type":"http request","z":"1543d308b342690a","name":"Doesn't work","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":525,"y":2430,"wires":[["da17a2650e86e8df"]]},{"id":"f820f20109811d05","type":"http request","z":"1543d308b342690a","name":"Works","method":"use","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":506,"y":2394,"wires":[["da17a2650e86e8df"]]},{"id":"da17a2650e86e8df","type":"debug","z":"1543d308b342690a","name":"debug 22","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":695,"y":2410,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [23 November 2022 12:17 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/10 "2022-11-23T12:17:40Z")

</div>

paytoqs  
I think the payload is NOT being appended to the URL

First

 ![Screenshot 2022-11-23 at 12.16.54](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/e/1eda6f56ec1bc18cfca3500cfc67da8376a9f612.png)

Second

 ![Screenshot 2022-11-23 at 12.17.21](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/2/92be0f32e98977780bf6c8f1b2ed3cb47b95f7c8.png)

Set method to `GET` - then you can select the payload behaviour

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [23 November 2022 12:23 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/11 "2022-11-23T12:23:33Z")

</div>

Yes I also noted the differences in the 2 screenshots (paytoqs).  
The GET command is already configured via `msg.method` in the change node.

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [23 November 2022 12:25 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/12 "2022-11-23T12:25:12Z")

</div>

I think the payload behaviour can only be chosen if the method is known during config.

- set to GET
- set to use payload as query
- deploy
- then set the method back to `msg.method`

this is just to allow us to set the payload behavior, and is only revealed when set to `GET`

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [23 November 2022 20:34 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/13 "2022-11-23T20:34:06Z")

</div>

> [@marcus-j-davies](#):
>
> I think the payload behaviour can only be chosen if the method is known during config

Thank Marcus, but is that documented anywhere? I've never heard of that, and it sort of defeats the purpose of passing in node properties using messages.

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [23 November 2022 21:43 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/14 "2022-11-23T21:43:27Z")

</div>

Hi @Paul-Reed

It’s what I observed in using it myself.

The **paytoqs** property controls how the payload should be treated for **GET** requests.

But from experience, it can only be set in the node config, the problem is, this option is only revealed to the user when the node is set to **GET**.

You can momentarily set it to **GET** to get to these options, but I would agree, it might be a slight over look with the editor layout for this node.

---

<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: [23 November 2022 21:57 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/15 "2022-11-23T21:57:20Z")

</div>

I think that should be submitted as a node-red issue at [Issues · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues)

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [23 November 2022 22:21 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/16 "2022-11-23T22:21:57Z")

</div>

> <https://github.com/node-red/node-red/issues/3957>
>
> \### Current Behavior
> 
> When \`- set by msg.method -\` is used for the method, it hi…des the payload handling dropdown on the node config editor.
> Now then, If the user does not first choose the payload handling option prior to selecting \`- set by msg.method -\` 
> 
> The users payload is ignored, i.e for GET requests, the payload is not passed in as a query string, as the default is to ignore it.
> 
> The user has to first set it back to GET, change the payload handling option, then set it back to \`- set by msg.method -\`.
> The option is there initially, but this could trip up new users.
> 
> 
> 
> 
> 
> \### Expected Behavior
> 
> Iether allow payload handling options to be include in the message, or to not hide the option
> 
> \### Steps To Reproduce
> 
> \- Add a new http-request node
> \- set it to \`- set by msg.method -\`
> \- Note that the payload handling option has gone 
> 
> \### Example flow
> 
> \_No response\_
> 
> \### Environment
> 
> \- Node-RED version: \*\*3.0.0\*\*
> \- Node.js version: \*\*16.15.1\*\*
> \- npm version: \*\*8.11.0\*\*
> \- Platform/OS: \*\*Debian\*\*
> \- Browser: \*\*Safari\*\*

---

<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: [24 November 2022 07:28 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/17 "2022-11-24T07:28:02Z")

</div>

If you make the suggested change in your failing node, does it fix it?

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [24 November 2022 09:25 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/18 "2022-11-24T09:25:33Z")

</div>

Yes it did, Marcus is correct.  
I've already DM'd the example flow to @Steve-Mcl

---

<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: [24 November 2022 09:31 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/19 "2022-11-24T09:31:50Z")

</div>

Excellent, could you mark one Marcus' replies as the solution so the forum will mark it as solved please.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [24 November 2022 20:29 UTC](https://discourse.nodered.org/t/http-request-node-returning-error/71101/20 "2022-11-24T20:29:54Z")

</div>

Weird one, well done Marcus for spotting it.

[Next page](https://discourse.nodered.org/t/http-request-node-returning-error/71101.md?page=2)
