Timed out while waiting for handshake
Closed this issue · 3 comments
Constantly getting error:
Error: Timed out while waiting for handshake
at Timeout._onTimeout (/Users/gajus/Documents/dev/contra/contra-manager/node_modules/ssh2/lib/client.js:1014:23)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
The script is simply:
const ssh = new NodeSSH();
await ssh.connect({
host,
privateKey: temporaryKeys.privateKey,
username: temporaryKeys.username,
});
Is there a configuration I am missing?
Have you tried connecting through regular SSH client? The error you're experiencing is a network error, and generally means the destination host is not reachable. If you can connect with the regular ssh client, but failing to be able to, with node-ssh then please let me know!
Firewall rules were modified in our organization without me knowing about it. This is what caused the failures.
Thank you for the response.
However, I still (occasionally) see this error, even when I can connect to SSH. Is there a way to increase the timeout limit?
We can pretty easily add a retry logic for these scenarios though.
node-ssh
pipes the connection options to ssh2 (https://github.com/mscdex/ssh2#client-methods). I think you can use the readyTimeout
option to potentially increase the timeout limit.
Good luck!