# Problem with format in HTTP Request node

**URL:** <https://discourse.nodered.org/t/problem-with-format-in-http-request-node/93184>\
**Category:** General\
**Tags:** http-request, function-node\
**Created:** [16 November 2024 09:01 UTC](https://discourse.nodered.org/t/problem-with-format-in-http-request-node/93184 "2024-11-16T09:01:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Graefe](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@Graefe](https://discourse.nodered.org/u/Graefe)\
**Post date:** [16 November 2024 09:01 UTC](https://discourse.nodered.org/t/problem-with-format-in-http-request-node/93184/1 "2024-11-16T09:01:46Z")

</div>

Hi, I have a function node which creates a token for use in a http request node.

```auto
let token = flow.get('token');

msg.cookies = {
    'IDALToken=' : token
    }
return msg;

```

Worked flawlessly, up to the update from Node Red 4.0 to 4.0.5. Now I get an error warning:  
`"TypeError: argument name is invalid"`

I suppose this has something to do with [Ensure will payload is a string #4873](https://github.com/node-red/node-red/pull/4873). How should I modify the function node to avoid this error? Thank you!  
Graefe

---

<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:** [16 November 2024 09:32 UTC](https://discourse.nodered.org/t/problem-with-format-in-http-request-node/93184/2 "2024-11-16T09:32:19Z")

</div>

Hi @Graefe

Sorry - what's the connection between the above (HTTP Looking) snippet and MQTT?  
also, unless its required by the service you're interacting with, the cookie name does not need an `=` after it

```auto
msg.cookies = {
    'IDALToken' : token
}
return msg;

```

Are you sure this error is coming from the above?  
maybe share a flow that reproduces the error?

---

<div class="post-metadata">

**Author:** ![Graefe](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@Graefe](https://discourse.nodered.org/u/Graefe)\
**Post date:** [16 November 2024 09:56 UTC](https://discourse.nodered.org/t/problem-with-format-in-http-request-node/93184/3 "2024-11-16T09:56:01Z")

</div>

Yes, this was the solution! No idea, why Node Red prior to 4.0.3 had no problems with this expression.  
The connection is, that there is a http-request node which uses the token as a cookie. And which sent the error - until now. I hope this describes the setup well enough. [Work with cookies : Node-RED](https://cookbook.nodered.org/http/work-with-cookies).  
Thank you!

---

<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:** [16 November 2024 10:00 UTC](https://discourse.nodered.org/t/problem-with-format-in-http-request-node/93184/4 "2024-11-16T10:00:35Z")

</div>

Awesome!

I have updated the title to represent the Node you had problems with.

---

<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:** [30 November 2024 10:00 UTC](https://discourse.nodered.org/t/problem-with-format-in-http-request-node/93184/5 "2024-11-30T10:00:51Z")

</div>

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