anderZubi
anderZubi

Reputation: 6424

Node-Red "http request" node stuck in requesting if no connection

I have a flow with a http request node in it, which makes POST calls to a web service.

Everything works ok, but if the device where Node-Red is running loses connection to Internet (it is connected through LTE), the node keeps stuck in requesting state, instead of returning an error.

node requesting

Is this the normal behaviour? Could I solve it by setting a timeout? How could it be done?

Upvotes: 2

Views: 4660

Answers (4)

Wlad Neto
Wlad Neto

Reputation: 381

To set timeout in your request, set msg.httpRequestTimeout with the number of miliseconds at the node before your request.

Example:

enter image description here

inside node "Set Timeout"

msg.httpRequestTimeout = 60000;
return msg;

Upvotes: 3

anderZubi
anderZubi

Reputation: 6424

Updating Node-RED to latest version resolved the issue. Now I get an error as I would expect, and Node-RED does not hang.

enter image description here

I have updated from version v0.19.5 to v 1.0.3.

Upvotes: 1

Ekoludzik
Ekoludzik

Reputation: 26

you can set requestTimeout input value for this particular node.

Upvotes: 0

Nemanja
Nemanja

Reputation: 194

My approach to this would be to first check if the internet is available (example: by pinging google) if it fails, then return an error.

Upvotes: 0

Related Questions