# ERR\_INVALID\_ARG\_TYPE on http request node

**URL:** https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441
**Category:** General
**Created:** [16 October 2024 15:00 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441 "2024-10-16T15:00:12Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![tomtom30](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomtom30/32/2527_2.png) [@tomtom30](https://discourse.nodered.org/u/tomtom30)
#### Post date: [16 October 2024 15:00 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/1 "2024-10-16T15:00:12Z")

</div>

Hi,  
when I try to send a get request with http request node , I get ERR\_INVALID\_ARG\_TYPE.

I have : `"RequestError: The "listener" argument must be of type function. Received an instance of Object" in debug.`

 ![Capture10](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/64fe2052648bfc8bf6f3871a643d7e4a123505fc.png)

I have this error in all the case.  
I have this with a cookbook flow : [Simple GET request : Node-RED](https://cookbook.nodered.org/http/simple-get-request#solution)

Can you help me please ?

---

<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: [16 October 2024 15:08 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/2 "2024-10-16T15:08:47Z")

</div>

Hi @tomtom30

Can you share what version of Node-RED you are using?

Have you modified the flow at all?

Nick

---

<div class="post-metadata">

### Author: ![tomtom30](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomtom30/32/2527_2.png) [@tomtom30](https://discourse.nodered.org/u/tomtom30)
#### Post date: [16 October 2024 15:17 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/3 "2024-10-16T15:17:41Z")

</div>

Hi,  
I am in v4.0.2 in docker.  
No , I have only imported from cookbook without modification.  
I have tried another exemple and all the flow with http request are doing the same error.

---

<div class="post-metadata">

### Author: ![tomtom30](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomtom30/32/2527_2.png) [@tomtom30](https://discourse.nodered.org/u/tomtom30)
#### Post date: [16 October 2024 16:15 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/4 "2024-10-16T16:15:46Z")

</div>

I have update to 4.0.5 but the issue still the same.

---

<div class="post-metadata">

### Author: ![tomtom30](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomtom30/32/2527_2.png) [@tomtom30](https://discourse.nodered.org/u/tomtom30)
#### Post date: [17 October 2024 14:27 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/5 "2024-10-17T14:27:16Z")

</div>

Hi,  
I have new informations about my issue.  
it looks like this one : [https://github.com/node-red/node-red/issues/4389](https://github.com/node-red/node-red/issues/4389) .  
I dont have installed any modules corresponding to the description.

In other way, I just have `RequestError: The "listener" argument must be of type function. Received an instance of Object` and no more information in logs even if iam in "trace" level logs.

Here is my package.json :

```auto
{
  "name": "node-red-project",
  "description": "A Node-RED Project",
  "version": "0.0.1",
  "dependencies": {
    "agent-base": "^7.1.1",
    "faux-api-client": "^1.0.9",
    "fcm-node": "^1.5.2",
    "fsevents": "^1.2.9",
    "lgtv2": "^1.4.1",
    "node-red-configurable-ping": "^1.0.1",
    "node-red-contrib-advance-logger": "~1.0.1",
    "node-red-contrib-advanced-ping": "^1.2.0",
    "node-red-contrib-asterisk": "0.0.3",
    "node-red-contrib-average": "~0.1.7",
    "node-red-contrib-better-sftp": "0.0.11",
    "node-red-contrib-bigssh": "~1.2.9",
    "node-red-contrib-blindcontroller": "~4.8.6",
    "node-red-contrib-buffer-parser": "~3.2.2",
    "node-red-contrib-calc": "~1.0.5",
    "node-red-contrib-cast": "~0.2.17",
    "node-red-contrib-combine": "~1.8.1",
    "node-red-contrib-counter": "~0.1.6",
    "node-red-contrib-cron-plus": "~1.5.7",
    "node-red-contrib-google-home-notifier-offline": "~1.1.1",
    "node-red-contrib-google-home-notify": "0.0.7",
    "node-red-contrib-google-smarthome": "~0.4.12",
    "node-red-contrib-harmony-websocket": "~2.2.6",
    "node-red-contrib-hysteresis": "~0.3.0",
    "node-red-contrib-image-output": "~0.6.2",
    "node-red-contrib-image-simple-node": "0.0.11",
    "node-red-contrib-image-tools": "~2.0.1",
    "node-red-contrib-interval-length": "~0.0.6",
    "node-red-contrib-kodi": "^0.2.8",
    "node-red-contrib-lgtv": "^1.1.0",
    "node-red-contrib-message-counter": "~1.0.1",
    "node-red-contrib-metrics": "0.0.1",
    "node-red-contrib-modbus": "~5.14.1",
    "node-red-contrib-mongodb2": "~0.5.6",
    "node-red-contrib-mongodb3": "~2.0.1",
    "node-red-contrib-moving-average": "~1.3.0",
    "node-red-contrib-openhab-v2": "~2.0.3",
    "node-red-contrib-plate-recognizer": "~1.0.3",
    "node-red-contrib-prib-functions": "~0.16.1",
    "node-red-contrib-queue-gate": "~1.5.4",
    "node-red-contrib-rflink": "~0.1.1",
    "node-red-contrib-sonos-plus": "~6.4.0",
    "node-red-contrib-spotify": "~0.1.4",
    "node-red-contrib-string": "~1.0.0",
    "node-red-contrib-summariser": "~1.0.1",
    "node-red-contrib-sunpos": "^1.4.1",
    "node-red-contrib-telegrambot": "~12.0.0",
    "node-red-contrib-throttle": "~0.1.7",
    "node-red-contrib-time-range-switch": "~1.1.2",
    "node-red-contrib-totaliser": "~0.0.11",
    "node-red-contrib-watt2kwh": "~0.1.2",
    "node-red-contrib-webhookrelay": "~0.3.0",
    "node-red-dashboard": "~3.0.4",
    "node-red-node-base64": "~0.3.0",
    "node-red-node-email": "~1.12.3",
    "node-red-node-msgpack": "~1.2.1",
    "node-red-node-mysql": "~1.0.3",
    "node-red-node-openweathermap": "~0.5.1",
    "node-red-node-random": "~0.4.0",
    "node-red-node-rbe": "~0.5.0",
    "node-red-node-serialport": "~0.14.1",
    "node-red-node-sqlite": "~1.0.1",
    "node-red-node-suncalc": "~1.0.1",
    "node-red-node-tail": "~0.3.1",
    "node-red-node-weather-underground": "^0.1.12",
    "node-red-node-wol": "~0.2.0",
    "serialport": "^7.1.5",
    "websocket": "^1.0.30"
  }
}

```

Is someone have an idea to help me, or do I need to open an issue on github ?

---

<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: [17 October 2024 15:49 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/6 "2024-10-17T15:49:08Z")

</div>

Show us the node-red startup log. I don't know how to get that in Docker, but hopefully you do. I suspect it will show a problem.

---

<div class="post-metadata">

### Author: ![tomtom30](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomtom30/32/2527_2.png) [@tomtom30](https://discourse.nodered.org/u/tomtom30)
#### Post date: [17 October 2024 16:32 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/7 "2024-10-17T16:32:09Z")

</div>

Thanks for your answer.  
I have extracted the startup log.  
I can't send it here because of many plain text tokens.  
I have read 1589 lines and no error show about this issue.  
The flow is lunching as same as the rest.

```auto
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] start flow [5fb2cde8bd5d6f74]
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] ------------------|--------------|-----------------
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] id | type | alias
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] ------------------|--------------|-----------------
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] d88dd470.0ac7b8 | inject | 
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] 874a3d4e.9b666 | http request | 
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] 7403c68f.21d7c8 | debug | 
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] 90243cc1.87edc | html | 
nodered_nodered.1.2o6v7nvd3a5r@docker13 | 17 Oct 18:22:37 - [trace] [flow:5fb2cde8bd5d6f74] ------------------|--------------|-----------------

```

The error is only generated when I trigger the inject node.

---

<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: [17 October 2024 16:52 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/8 "2024-10-17T16:52:02Z")

</div>

Hi @tomtom30

You are right this appears to be the same as the issue you link to. In which case, one of the nodes you have installed is polluting your setup and causing this problem.

The task is to figure out which from that long list of nodes you have installed is causing it. That will take some time to dig through the list - and I need to remember what to look for. I'll see if I can find the culprit for you....

Nick

---

<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: [17 October 2024 17:15 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/9 "2024-10-17T17:15:52Z")

</div>

Assuming you are hitting the same root cause as the linked issue (and the error message means that is highly likely), what we are looking for is a module that has pulled in `agent-base < 5.0`.

I have installed all the modules you have listed, and whilst they do cause `agent-base` to be pulled in, it is at a later version that works. So it may be that you do have an older agent-base installed somehow else.

Are you able to open a shell in the container, and run `npm list agent-base` in the directory containing your package.json file?

---

<div class="post-metadata">

### Author: ![tomtom30](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomtom30/32/2527_2.png) [@tomtom30](https://discourse.nodered.org/u/tomtom30)
#### Post date: [17 October 2024 17:34 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/10 "2024-10-17T17:34:31Z")

</div>

I guess you allright.

here is `npm list agent-base` :

```auto
npm list agent-base
node-red-project@0.0.1 /data
+-- agent-base@7.1.1
+-- fcm-node@1.5.2
| `-- https-proxy-agent@2.2.2
| `-- agent-base@4.3.0
+-- node-red-contrib-cast@0.2.17
| `-- snyk@1.460.0
| `-- proxy-agent@3.1.1
| +-- agent-base@4.3.0
| +-- http-proxy-agent@2.1.0
| | `-- agent-base@4.3.0
| +-- https-proxy-agent@3.0.1
| | `-- agent-base@4.3.0 deduped
| +-- pac-proxy-agent@3.0.1
| | +-- agent-base@4.3.0
| | `-- https-proxy-agent@3.0.1
| | `-- agent-base@4.3.0 deduped
| `-- socks-proxy-agent@4.0.2
| `-- agent-base@4.2.1
+-- node-red-contrib-google-smarthome@0.4.14
| +-- google-auth-library@9.14.2
| | `-- gaxios@6.7.1
| | `-- https-proxy-agent@7.0.5
| | `-- agent-base@7.1.1 deduped
| `-- googleapis@144.0.0
| +-- google-auth-library@9.14.2
| | `-- gaxios@6.7.1
| | `-- https-proxy-agent@7.0.5
| | `-- agent-base@7.1.1 deduped
| `-- googleapis-common@7.2.0
| `-- gaxios@6.7.1
| `-- https-proxy-agent@7.0.5
| `-- agent-base@7.1.1 deduped
+-- node-red-contrib-prib-functions@0.20.4
| `-- npm@10.9.0
| +-- @sigstore/tuf@2.3.4
| | `-- tuf-js@2.2.1
| | `-- make-fetch-happen@13.0.1
| | `-- @npmcli/agent@2.2.2
| | `-- agent-base@7.1.1 deduped
| +-- libnpmpublish@10.0.0
| | `-- sigstore@2.3.1
| | `-- @sigstore/sign@2.3.2
| | `-- make-fetch-happen@13.0.1
| | `-- @npmcli/agent@2.2.2
| | `-- agent-base@7.1.1 deduped
| +-- make-fetch-happen@14.0.1
| | `-- @npmcli/agent@3.0.0
| | +-- agent-base@7.1.1
| | +-- http-proxy-agent@7.0.2
| | | `-- agent-base@7.1.1 deduped
| | +-- https-proxy-agent@7.0.5
| | | `-- agent-base@7.1.1 deduped
| | `-- socks-proxy-agent@8.0.4
| | `-- agent-base@7.1.1 deduped
| `-- node-gyp@10.2.0
| `-- make-fetch-happen@13.0.1
| `-- @npmcli/agent@2.2.2
| `-- agent-base@7.1.1 deduped
+-- node-red-contrib-telegrambot@16.1.0
| `-- socks-proxy-agent@8.0.4
| `-- agent-base@7.1.1 deduped
`-- node-red-node-sqlite@1.1.0
  `-- sqlite3@5.1.7
    `-- node-gyp@8.4.1
      `-- make-fetch-happen@9.1.0
        +-- http-proxy-agent@4.0.1
        | `-- agent-base@6.0.2
        +-- https-proxy-agent@5.0.1
        | `-- agent-base@6.0.2 deduped
        `-- socks-proxy-agent@6.2.1
          `-- agent-base@6.0.2 deduped

```

I have tried to `npm uninstall agent-base` and `npm install agent-base` before write here.  
That's why i am running 7.1.1 ( latest version ).

Unfortunatly, some dependencies still \< 5.0.0.  
My level in npm is not good so I don't know how I can upgrade all dependencies.

Thanks

---

<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: [17 October 2024 19:15 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/11 "2024-10-17T19:15:55Z")

</div>

Are all your nodes at the latest versions? Check in manage pallet

---

<div class="post-metadata">

### Author: ![tomtom30](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomtom30/32/2527_2.png) [@tomtom30](https://discourse.nodered.org/u/tomtom30)
#### Post date: [17 October 2024 20:06 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/12 "2024-10-17T20:06:45Z")

</div>

Yeah !!!  
It is ok.  
Have update fcm-node manually ( out of pallet ) and removed node-red-contrib-cast ( not used ).  
Both of them use agent-base \< 5.0.0.

Http-request node back in business !

Really Thanks Nick and Colin !

---

<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: [17 October 2024 20:21 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/13 "2024-10-17T20:21:23Z")

</div>

> [@tomtom30](#):
>
> `fcm-node`

Hasn't Google's Firebase Cloud Messaging (FCM) been switched off now? I certainly got notifications that I had to change to the new API as it was being closed down.

---

<div class="post-metadata">

### Author: ![tomtom30](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomtom30/32/2527_2.png) [@tomtom30](https://discourse.nodered.org/u/tomtom30)
#### Post date: [22 October 2024 12:01 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/14 "2024-10-22T12:01:03Z")

</div>

To be honest iam not using FCM since 2 years so I think you are right about it.

---

<div class="post-metadata">

### Author: ![johnwalicki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnwalicki/32/8848_2.png) [@johnwalicki](https://discourse.nodered.org/u/johnwalicki)
#### Post date: [27 October 2024 18:04 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/15 "2024-10-27T18:04:32Z")

</div>

I just tripped over the same error `RequestError: The "listener" argument must be of type function. Received an instance of Object` after upgrading to Node-RED 4.0.5  
Spent an evening chasing it down. Thankfully, found this thread. (Thanks!)

I had to clear out some old @tensorflow packages.

$ npm list agent-base  
node-red-project@0.0.1 /home/walicki/.node-red  
├─┬ @tensorflow/tfjs-node-gpu@1.7.4  
│ └─┬ https-proxy-agent@2.2.4  
│ └── agent-base@4.3.0

Removed this

---

<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: [25 January 2025 18:04 UTC](https://discourse.nodered.org/t/err-invalid-arg-type-on-http-request-node/92441/16 "2025-01-25T18:04:57Z")

</div>

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