Httprequest node - help

Folks, a while back other (smarter) people wrote a quick bit of code for me that uses the httprequest node.

I'm wanting to use it again in a similar way but am getting nowhere - fast.

Every time I force a request, I get errors back.

Example flow:

[{"id":"89f681ae64bd6135","type":"inject","z":"65c9b63cb09879a0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":3350,"y":180,"wires":[["dcd80a56f41caa81"]]},{"id":"dcd80a56f41caa81","type":"http request","z":"65c9b63cb09879a0","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://discourse.nodered.org/","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Accept","keyValue":"","valueType":"text/plain","valueValue":""},{"keyType":"User-Agent","keyValue":"","valueType":"other","valueValue":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0"}],"x":3520,"y":180,"wires":[["3af232784383f3b8"]]},{"id":"3af232784383f3b8","type":"debug","z":"65c9b63cb09879a0","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":3680,"y":180,"wires":[]}]

I get back:

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

and

{"_msgid":"fccdf90acf47169e","payload":"RequestError: The \"listener\" argument must be of type function. Received an instance of Object : https://discourse.nodered.org/","topic":"","statusCode":"ERR_INVALID_ARG_TYPE"}

Sorry, but I'm stuck.

A quick google search for the error led me to ERR_INVALID_ARG_TYPE on http request node

Are all your nodes up to date? Check in Manage Palette.

NR 4.0.9
httprequest 0.1.14

No update showing for that node.

HANG ON!

This is weird.

What's going on here?

Other machines don't have that second entry.

You have installed a contrib node for http request. You don't need that, uninstall it and use the core one. No doubt there is a conflict between it and the core one.

Hang on while I restart NR and I'll post what happens then.

DONE

Alas, no change. Exactly the same.

Browser refreshed.....

Hang on... I'll try in a private window.
(Sorry)

Private window.

Same result.

Acting on what is in the other thread:

npm list agent-base
node-red-project@0.0.1 /home/me/.node-red
โ”œโ”€โ”ฌ node-red-contrib-speed-test@0.1.2
โ”‚ โ””โ”€โ”ฌ speedtest-net@1.6.2
โ”‚   โ”œโ”€โ”ฌ http-proxy-agent@2.1.0
โ”‚   โ”‚ โ””โ”€โ”€ agent-base@4.3.0
โ”‚   โ””โ”€โ”ฌ https-proxy-agent@3.0.1
โ”‚     โ””โ”€โ”€ agent-base@4.3.0
โ””โ”€โ”ฌ node-red-contrib-tts-ultimate@2.0.5
  โ”œโ”€โ”ฌ @google-cloud/text-to-speech@4.2.2
  โ”‚ โ””โ”€โ”ฌ google-gax@3.6.1
  โ”‚   โ””โ”€โ”ฌ google-auth-library@8.9.0
  โ”‚     โ””โ”€โ”ฌ gaxios@5.1.3
  โ”‚       โ””โ”€โ”ฌ https-proxy-agent@5.0.1
  โ”‚         โ””โ”€โ”€ agent-base@6.0.2 deduped
  โ””โ”€โ”ฌ microsoft-cognitiveservices-speech-sdk@1.29.0
    โ”œโ”€โ”€ agent-base@6.0.2
    โ””โ”€โ”ฌ https-proxy-agent@4.0.0
      โ””โ”€โ”€ agent-base@5.1.1

Helpful?

As you can see, agent-base for node-red-contrib-speed-test is less than version 5 so is probably the problem. That node has not been updated in nearly 9 years so it is not surprising it is pulling in junk.

1 Like

So - sorry - the obvious question is HOW do I update it?

I only recently updated from NR 3.x to 4.x

:person_shrugging:

(Re-reading the post)

Ok, so that node is KILLING the whole thing?

:confused:

So what happens if I want both installed at the same time?

You can't, the problem is in node-red-contrib-speed-test. It is pulling in an ancient version of agent base. You could potentially fork the node's source and try and fix it yourself, but the speed test node might not be compatible with a later version of agent base.

BIG UPDATE!

Ok, I'm posting for THIS machine. And fair enough.

Just to test myself and my sanity, I went to a RasPi. (Not the best idea as this is POWERFUL, the RasPi is an old 3B+)

The script posted works on the RasPi.

AND

That machine also has speedtest installed on it.

So something else is happening behind the scenes.

But thanks for the help.
(No offence meant either)

Working machine specs:

Raspberry Pi 2 Model B Rev 1.1

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

NR 3.0.2

pi@BedPi:~/.node-red $ npm list agent-base
node-red-project@0.0.1 /home/pi/.node-red
โ””โ”€โ”€ (empty)

pi@BedPi:~/.node-red $ 

:confused:

node-red-contrib-speedtest
1.1.0

So is it NR v4.x that is where it all falls apart?

That is a different speed test node.

Ok, sorry....

I got rid of the wrong one. I hope.

What I've done ITMT:

I got it working on the Pi.

EXPORTED it, IMPORTED it to THIS machine - bigger, faster, etc... But NR v 4.x

No conflicts.

Throws an error. (But didn't on the Pi)

'An' error or the same error?

If the same one what does npm list agent-base show now?

(Sorry Colin.... Just lost THIS MACHINE's entire NR flow/stuff.)

HUGE DAMAGE CONTROL

(Found back up. Lost 2 months of work)

On the Pi the posted flow works.

On THIS machine it doesn't.

Same flow, same nodes..... So would/could it be a NR V3 to V4 be a problem?

When run on this machine I get the error/s as posted.

You didn't answer the question

(Sorry... Hang on)

This machine:

me@me-desktop:~/.node-red$ npm list agent-base
node-red-project@0.0.1 /home/me/.node-red
โ””โ”€โ”ฌ node-red-contrib-tts-ultimate@2.0.5
  โ”œโ”€โ”ฌ @google-cloud/text-to-speech@4.2.2
  โ”‚ โ””โ”€โ”ฌ google-gax@3.6.1
  โ”‚   โ””โ”€โ”ฌ google-auth-library@8.9.0
  โ”‚     โ””โ”€โ”ฌ gaxios@5.1.3
  โ”‚       โ””โ”€โ”ฌ https-proxy-agent@5.0.1
  โ”‚         โ””โ”€โ”€ agent-base@6.0.2 deduped
  โ””โ”€โ”ฌ microsoft-cognitiveservices-speech-sdk@1.29.0
    โ”œโ”€โ”€ agent-base@6.0.2
    โ””โ”€โ”ฌ https-proxy-agent@4.0.0
      โ””โ”€โ”€ agent-base@5.1.1

I'll have to rebuild/write the flow to be sure it is STILL failing.
(Again, hang on)

Torn between posting or getting the results then posting.

UPDATE

Ok, it is now working.
(Of course)

So - thinking about what just happened - Something I installed in the last 2/3 months messed it.

AFAIK, that is only the new dashboard.

Thoughts?

It was the speed-test node.

So out of the box there is a speed-test node in NR?

No. I meant the error was caused by node-red-contrib-speed-test. The one on the working system is node-red-contrib-speedtest.

I'm really confused then.

:frowning:

:cry:

I now have this node installed:
node-red-contrib-speedtest (version 1.1.0)
I have DB-2 installed and things are working.

I now have http request as per the first post. It now works.
(This machine)

Sorry... I'm not understanding what's going on.

I am prepared to just accept it and move on. But the cat in me is kinda curious. :wink:

Oh the other command: (npm list agent-base)

me@me-desktop:~/.node-red$ npm list agent-base
node-red-project@0.0.1 /home/me/.node-red
โ””โ”€โ”ฌ node-red-contrib-tts-ultimate@2.0.5
  โ”œโ”€โ”ฌ @google-cloud/text-to-speech@4.2.2
  โ”‚ โ””โ”€โ”ฌ google-gax@3.6.1
  โ”‚   โ””โ”€โ”ฌ google-auth-library@8.9.0
  โ”‚     โ””โ”€โ”ฌ gaxios@5.1.3
  โ”‚       โ””โ”€โ”ฌ https-proxy-agent@5.0.1
  โ”‚         โ””โ”€โ”€ agent-base@6.0.2 deduped
  โ””โ”€โ”ฌ microsoft-cognitiveservices-speech-sdk@1.29.0
    โ”œโ”€โ”€ agent-base@6.0.2
    โ””โ”€โ”ฌ https-proxy-agent@4.0.0
      โ””โ”€โ”€ agent-base@5.1.1

Yes, I see the speed-test entry is not listed.
I don't understand how that part works.