Skip to content

[Bug]: Terminal not accessibleΒ #4579

Description

@dickermoshe

Error Message and Logs

I've installed coolify on a spare laptop.
I used Cloudflare tunnels to access it remotely.
I set the correct environmental vars so that the the realtime and terminal api should work on the frontend.

REALTIME websockets work, But TERMINAL websockets do NOT!

Steps to Reproduce

  1. Install Coolify on a Server
  2. Navigate to Terminal Page
    ERROR: Terminal websocket connection lost.

Ok, let's use curl on localhost to see what's going on:

root@oldlaptop:/home/mick# curl localhost:6002/ready
OK

Seems like the server for the realtime API is running, that's good

Let's get those logs:

root@oldlaptop:/hodocker logs 4bb1497b23c9 -tv
2024-12-15T02:28:25.311313459Z 2024-12-15 02:28:25 [TERMINAL] Coolify realtime terminal server listening on port 6002. Let the hacking begin!
2024-12-15T02:28:25.576541725Z 2024-12-15 02:28:25 [SOKETI]
2024-12-15T02:28:25.584539981Z 2024-12-15 02:28:25 [SOKETI] πŸ•΅οΈβ€β™‚οΈ Initiating metrics endpoints...
2024-12-15T02:28:25.585333414Z 2024-12-15 02:28:25 [SOKETI]
2024-12-15T02:28:25.586187631Z 2024-12-15 02:28:25 [SOKETI] πŸŽ‰ Server is up and running!
2024-12-15T02:28:25.587015263Z 2024-12-15 02:28:25 [SOKETI] πŸ“‘ The Websockets server is available at 127.0.0.1:6001
2024-12-15T02:28:25.587567900Z 2024-12-15 02:28:25 [SOKETI] πŸ”— The HTTP API server is available at http://127.0.0.1:6001
2024-12-15T02:28:25.588409286Z 2024-12-15 02:28:25 [SOKETI] 🎊 The /usage endpoint is available on port 9601.
2024-12-15T02:28:25.588987941Z 2024-12-15 02:28:25 [SOKETI]
2024-12-15T02:28:25.589690367Z 2024-12-15 02:28:25 [SOKETI] (node:8) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.
2024-12-15T02:28:25.590229087Z 2024-12-15 02:28:25 [SOKETI]
2024-12-15T02:28:25.590810387Z 2024-12-15 02:28:25 [SOKETI] Please migrate your code to use AWS SDK for JavaScript (v3).
2024-12-15T02:28:25.591389923Z 2024-12-15 02:28:25 [SOKETI] For more information, check the migration guide at https://a.co/7PzMCcy
2024-12-15T02:28:25.592023949Z 2024-12-15 02:28:25 [SOKETI] (Use `node --trace-warnings ...` to show where the warning was created)

Hmmm, looks like everything is ok.
Let's try copying the request from chrome and seeing if it works from the CLI
Image

We can use a tool like websocat to test if this works locally:

root@oldlaptop:/home/mick# websocat 'ws://localhost:6002'   -H 'Upgrade: websocket'   -H 'Origin: https://coolify.dickersystems.com'   -H 'Cache-Control: no-cache'   -H 'Accept-Language: en-US,en;q=0.9'   -H 'Pragma: no-cache'   -H 'Connection: Upgrade'   -H 'Sec-WebSocket-Key: RB72t/uvO8ejOMLhMQljUA=='   -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'   -H 'Sec-WebSocket-Version: 13'   -H 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits'
websocat: WebSocketError: WebSocketError: Received unexpected status code (400 Bad Request)
websocat: error running

Hmmm, it doesn't. No logs in docker logs either. Seems like we need better logging!!

We can confirm that copything from curl SHOULD work by copying the request from the realtime websocket that is working.
Image

root@oldlaptop:/home/mick# websocat 'ws://localhost:6001/app/REDACTED?protocol=7&client=js&version=8.3.0&flash=false'   -H 'Upgrade: websocket'   -H 'Origin: https://coolify.dickersystems.com'   -H 'Cache-Control: no-cache'   -H 'Accept-Language: en-US,en;q=0.9'   -H 'Pragma: no-cache'   -H 'Connection: Upgrade'   -H 'Sec-WebSocket-Key: +has5XTnkQrT1iRzO6Lx3g=='   -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'   -H 'Sec-WebSocket-Version: 13'   -H 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits'
{"event":"pusher:connection_established","data":"{\"socket_id\":\"REDACTED\",\"activity_timeout\":30}"}

Example Repository URL

No response

Coolify Version

v4.0.0-beta.379

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24.04.1 LTS

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions