Erroe: failed to write to incoming websocket: ConnectionClosed
Hi,
I'm having an issue with:
tunnelto 0.1.18
I'm trying to tunnel a wss connection however I'm getting an error. The same connection works with ngrock. The following are the two commands and the error logs:
ngrok http -region eu -hostname=### 172.28.1.3:8080
tunnelto --host 172.28.1.3 --subdomain ###--port 8080 -v
Logs:
101 GET /v1/graphql
DEBUG tunnelto::local > read from local service: "<non utf8>"
DEBUG tunnelto::introspect::console_log > no log line for response
INFO tunnelto > got end stream [StreamId([206, 121, 210, 111, 39, 161, 7, 18])]
DEBUG tunnelto > Processed packet: "END STREAM"
DEBUG tunnelto::local > read from local service: "<non utf8>"
DEBUG tunnelto::introspect::console_log > no log line for response
WARN tunnelto::local > closing stream
DEBUG tunnelto::local > read from local service: "<non utf8>"
DEBUG tunnelto::introspect::console_log > no log line for response
WARN tunnelto::local > closing stream
ERROR tunnelto::introspect > failed to write to incoming websocket: ConnectionClosed
INFO tunnelto::local > done reading from client stream
ERROR tunnelto::introspect > failed to write to incoming websocket: ConnectionClosed
INFO tunnelto::local > done reading from client stream
ERROR tunnelto::introspect > failed to write to incoming websocket: ConnectionClosed
INFO tunnelto::local > done reading from client stream
ERROR tunnelto::introspect > failed to write to incoming websocket: ConnectionClosed
INFO tunnelto::local > done reading from client stream
DEBUG tunnelto::local > read from local service: "<non utf8>"
DEBUG tunnelto::introspect::console_log > no log line for response
WARN tunnelto::local > closing stream
ERROR tunnelto::introspect > failed to write to incoming websocket: ConnectionClosed
INFO tunnelto::local > done reading from client stream
ERROR tunnelto::introspect > failed to write to incoming websocket: ConnectionClosed
INFO tunnelto::local > done reading from client stream
INFO tunnelto > stream["stream_iB4XD1s61LE"] -> init
DEBUG tunnelto > Processed packet: "INIT STREAM"
INFO tunnelto > stream["stream_iB4XD1s61LE"] -> new data: 991
INFO tunnelto::local > setting up local stream: stream_iB4XD1s61LE
INFO tunnelto > forwarded to local tcp (stream_iB4XD1s61LE)
DEBUG tunnelto > Processed packet: "STREAM DATA"
DEBUG tunnelto::local > wrote to local service: 991
DEBUG tunnelto::local > read from local service: "HTTP/1.1 101 Switching Protocols\r\nconnection: upgrade\r\nupgrade: websocket\r\nsec-websocket-accept: SKh2fziQyGpvgv3E0GZTAMiTZnI=\r\ndate: Fri, 04 Jun 2021 14:23:41 GMT\r\n\r\n"
I'm having the same issues with websocket connections when trying to run a code-server instance. The issue doesn't happen when issue ngrock or localtunnel alternatives.
Similar/same issue. I guess we are all using Hasura/GraphQL subscriptions over websockets? For unknown reasons, a websocket connection can not be established.
Yes, it's Hasura subscriptions.
I'm also seeing similar issues when trying to expose a Guacamole console (https://guacamole.apache.org/). This works using localtunnel, but I preferred this implementation as (a) it is in Rust and (b) it has the potential to scale out.
I assume tunnelto is meant to support websockets?
Hi -- we do support web sockets, though it seems like something is not working with hasura/guacamole. For example, this web socket example works just fine from my testing: https://github.com/gorilla/websocket/tree/master/examples/chat (note: adjust ws to wss in the html).
Can someone share a simple to replicate example?
Hi: I rewrote a bit of the local tcp forwarding logic which I think might solve some of these more complex cases. Would someone be able to try a latest version to see if this fixes it for them?
cargo install tunnelto --force --version 0.1.19
(note 0.1.19 is not pushed to brew just yet) Thanks!
edit: it's really easy to get cargo if you don't have it, https://rustup.rs
0.1.19 fixed my issue loading wss urls
Hi @agrinman, I too have issues with use of WebSockets and would like to try this 0.1.19 version. I'm using Homebrew on macOS. However, I can't find version 0.1.19 anywhere on GitHub or in Homebrew. Any pointers as to how I can get this version or fix the issue in another way?
@jvalteren was having this issue and found this page as a result.
I'm on a Mac and was also using the Homebrew version.
cargo install tunnelto --force --version 0.1.19
(I have rust installed via Homebrew)
You do need to either uninstall the Homebrew version or make sure you're using the full path to the v0.1.19 one, e.g.:
/Users/cwspear/.cargo/bin/tunnelto --port 8080
All that said, I get a different error when using 0.1.19:
CONNECTION REFUSED
ERROR tunnelto > failed to open local tunnel
ERROR tunnelto > got data but no stream to send it to.
ERROR tunnelto::local > failed to connect to local service: Connection refused (os error 61)
It doesn't work at all, so it's worse off than 0.1.18 :(
Thanks @CWSpear.
@agrinman what is the status of the rewritten local TCP forwarding logic? Any chance of pushing this to Homebrew?