balena tunnel: [Error] connect ETIMEDOUT

The balena tunnel command (balena CLI) may result in an ETIMEDOUT error:

$ balena tunnel 6b1e674 -p 22222
[Info]    Opening a tunnel to 6b1e674339ff7df836ac92c686e938ba...
[Info]     - tunnelling localhost:22222 to 6b1e674339ff7df836ac92c686e938ba:22222
[Info]    Waiting for connections...
[Error] => ===> :: connect ETIMEDOUT

The solution is to upgrade the balena CLI to v12.38.5 or later: installation instructions.

This is a known issue if you are using a CLI release older than v12.38.5. It happens because balena has recently updated the backend endpoint to enforce TLS encryption between the CLI and balenaCloud for the balena tunnel command. Old CLI releases attempt to use the old endpoint that has been blocked, hence the timeout.

Some additional details can be found in: balena tunnel: [Error] connect ETIMEDOUT · Issue #2172 · balena-io/balena-cli · GitHub

In the case of openBalena, ensure that CLI v12.38.5 or later is used with openBalena v3.1.2 or later, and use older CLI releases with older openBalena releases. Instructions on updating openBalena have recently been added to the openBalena Getting Started guide.