ERR_INVALID_ARG_TYPE on http request node

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.

I have this error in all the case.
I have this with a cookbook flow : Simple GET request : Node-RED

Can you help me please ?

Hi @tomtom30

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

Have you modified the flow at all?

Nick

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.

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

Hi,
I have new informations about my issue.
it looks like this one : 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 :

{
  "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 ?

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.

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.

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.

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

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?

I guess you allright.

here is npm list agent-base :

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

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

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 !

2 Likes

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.

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