Blocking error blocking error

nodered 3.1.7, after a few days of functioning correctly nodered crashes and I have to restart it manually to make it work. here is the error log it writes :Unhandled rejection RequestError: Error: read ETIMEDOUT at new RequestError (/data/node_modules/request-promise-core/lib/errors.js:14:15) at Request.plumbing.callback (/data/node_modules/request-promise-core/lib/plumbing.js:87:29) at Request.RP$callback [as _callback] (/data/node_modules/request-promise-core/lib/plumbing.js:46:31) at self.callback (/data/node_modules/request/request.js:185:22) at Request.emit (node:events:513:28) at Request.onRequestError (/data/node_modules/request/request.js:877:8) at ClientRequest.emit (node:events:513:28) at TLSSocket.socketErrorListener (node:_http_client:494:9) at TLSSocket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21)

what could this be due to? has anyone had this problem before

A node or function node using the package request is not correctly handling exceptions.

Are you making http requests from within a function node?

yes it is a sequence for querying the API of a site, for now it is disabled but I would like to restore it, I can't find the error even by trial and error it keeps giving an error after a few hours of operation. Sorry for replying now but the forum notification service is not working for me.

Add try .. catch blocks around the requests in the function node, that should catch the error.

1 Like

If you are doing async, use try...catch if you are using promises, add a .catch handler.

Better still, use the built in http-request node and it is all done for you.

1 Like

@colin,@steve,
I will now try to edit then write down what I have changed

Why are you not using the http node?

the node is this, basically it is an alert that reads api data on bybit, compares it to a minimum set by dashboard page, and if it is below the threshold it sends a voice alert with alexa.
flows.json (15,0 KB)
can't find the error in the http request :sweat:

For the future please see this post for details of the preferred method of posting flows - How to share code or flow json

Earlier you said that you were making http requests from within a function node, but the flow you posted is using an http request node. Are you saying that the http request node is generating the error that you posted at the start?

Yes, and I don't know what to think anymore.

That is unlikely. The error in the first post comes from /data/node_modules/request/request.js (AKA request lib) whereas Node-RED HTTP-Request node uses GOT lib)

however, by disabling the node mentioned above ,nodered does not crash and works regularly

yes, probably because of what follows - the alexa node. If the request is disabled, the next nodes in the chain are NOT triggered!

so it would mean that the 'error is not to be found in the flow that I reported above , but in the others that I have ?

Disconnect the wire to the alexa node and see what happens.
If it still crashes then disconnect the wire from the http request node and try again. Then work forward till you find the problem node.

1 Like