HTTP-Request / RequestError: The "listener" argument must be of type function

Hello,

I already searched the forum but the given answers do not match my problem.
When using the HTTP request node I also get the error:

RequestError: The "listener" argument must be of type function. Received an instance of Object

I already checked the agent-base by typing:

npm list agent-base

The result, as you can see, does not show a agent-base usage below version 6.

e1447ef04588:~$ npm list agent-base
node-red-docker@4.1.5 /usr/src/node-red
└─┬ node-red@4.1.5
  └─┬ @node-red/nodes@4.1.5
    └─┬ https-proxy-agent@5.0.1
      └── agent-base@6.0.2

Any ideas?

I assume you are referring to this post and thats why you are mentioning agent-base!

well, in that ^ case, it was a node package installed in the palette.

The dir you are scanning is not the userDir

This ^ is the main node-red app install - there will be node modules installed into your runtime in the package for the running node-red project. Often that is /data (or on non-docker, ~/.node-red)

Have a look at your start up log and look out for userDir (probably set to /data)
CD into that and do the same check

In fact, do npm ls and show us what you have in there.

Hi,

thank you - I wasn't aware that the base directory in which I run "npm list" is relevant.

Now, running it - as you recommended - in the "/data" directory I get:

node-red-project@0.0.1 /data
└─┬ node-red-contrib-mqtt-dynamicsub@0.0.9
  └─┬ https-proxy-agent@3.0.1
    └── agent-base@4.3.0

I deleted the two nodes from my project (hope to find an alternative node for dynamic MQTT input later). I restarted the container and the HTTP request works now.

Thank you very much!!!

The core mqtt node will now do dynamic subscription, though it depends on exactly what you need whether it does what you want.

We probably need something in NR core to alert this issue!

Or some way of flagging modules (and dependencies) as being problematic for certain versions of node-red?

Demo here using built in MQTT nodes

Note also, this package looks to be abandoned. This issue was raised in 2024: tool using old agent-base · Issue #2 · crowbarz/node-red-contrib-mqtt-dynamicsub · GitHub