It appears that balena ssh no longer properly accepts piped input (as of version 17). The examples in balena ssh --help still show this as being an option, but it does not function this way anymore. Instead, piped in characters seem to be interpreted as the container name to SSH to.
See the following example:
> echo "uptime; exit;" | balena ssh <device ID>
Could not find a container matching service name "uptime; exit;" on device "<device ID>".
It has previously worked on balena-cli version 16.7.6, but I have not bisected further. Release notes do not indicate an obvious change to point to but I haven’t looked that closely yet.