Reputation: 6424
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.
Is this the normal behaviour? Could I solve it by setting a timeout? How could it be done?
Upvotes: 2
Views: 4660
Reputation: 381
To set timeout in your request, set msg.httpRequestTimeout with the number of miliseconds at the node before your request.
Example:
inside node "Set Timeout"
msg.httpRequestTimeout = 60000;
return msg;
Upvotes: 3
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.
I have updated from version v0.19.5 to v 1.0.3.
Upvotes: 1
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