Cannot connect to postgres or ssh with flyctl

Hello everyone,

I have decided to give fly a try but unfortunately was not successful. First of all the amsterdam region was failing to create the resources (Timeout) and then I tried a few other regions which were creating the resource but I was not able to connect to the deployments. flyctl gave me the following error:

> fly postgres connect -a my-db-name
Error ssh: can't build tunnel for personal: Post "https://api.fly.io/graphql": unexpected EOF

and also

> fly ssh console -a my-db-name
Error ssh: can't build tunnel for personal: server returned a non-200 status code: 504

Is there some configuration that I am missing?

  1. Is the fly CLI showing any errors at your end if you run fly doctor?
$ fly doctor
Testing authentication token... PASSED
Testing flyctl agent... PASSED
Testing local Docker instance... Nope
Pinging WireGuard gateway (give us a sec)... PASSED
  1. Are you able to connect to https://api.fly.io/graphql? The first error suggests perhaps not. To check try loading https://api.fly.io/graphql in your browser - do you see the GraphQL page? I don’t know if that’s officially supported, auth etc, however it would at least check you are able to make requests to it. If not, that will cause problems.

I’ve tried the fly doctor but got the same result.

Testing authentication token... PASSED
Testing flyctl agent... PASSED
Testing local Docker instance... PASSED
Pinging WireGuard gateway (give us a sec)... FAILED
(Error: ping gateway: pinger: Post "https://api.fly.io/graphql": unexpected EOF)

We can't establish connectivity with WireGuard for your personal organization.

WireGuard runs on 51820/udp, which your local network may block.

And here is the logs from the fly agent

022/04/18 02:12:18.617696 srv OK 26091
2022/04/18 02:12:22.156847 #1 connected ...
2022/04/18 02:12:22.157080 #1 <- (    4) "ping"
2022/04/18 02:12:22.157658 #1 -> (   58) "8\x00ok {\"PID\":26091,\"Version\":\"0.0.320\",\"Background\":false}\n"
2022/04/18 02:12:22.157728 #1 dropped.
2022/04/18 02:12:22.158651 #2 connected ...
2022/04/18 02:12:22.158785 #2 <- (    4) "ping"
2022/04/18 02:12:22.158941 #2 -> (   58) "8\x00ok {\"PID\":26091,\"Version\":\"0.0.320\",\"Background\":false}\n"
2022/04/18 02:12:22.158995 #2 dropped.
2022/04/18 02:12:22.162624 #3 connected ...
2022/04/18 02:12:22.163116 #3 <- (    4) "ping"
2022/04/18 02:12:22.163987 #3 -> (   58) "8\x00ok {\"PID\":26091,\"Version\":\"0.0.320\",\"Background\":false}\n"
2022/04/18 02:12:22.164451 #3 dropped.
2022/04/18 02:12:22.346157 #4 connected ...
2022/04/18 02:12:22.346246 #4 <- (   18) "establish personal"
Creating WireGuard peer "interactive-agent-REDACTED-gmail-com-546" in region "ams" for organization personal
2022/04/18 02:13:23.001782 #4 -> (   55) "5\x00err Post \"https://api.fly.io/graphql\": unexpected EOF"
2022/04/18 02:13:23.001863 #4 dropped.
2022/04/18 02:14:19.067987 srv validated wireguard peers

I’ve also tried with my mobile hotspot but no difference. But I can open the graphql url in browser and it shows the playground. Also every other command in flyctl work!

Hmm. Given your fly doctor reports it was unable to connect using Wireguard (compared to mine which could) that certainly looks to be the problem.

Fly apparently have added websocket support in the latest version and so that may help. Can’t hurt to try! Download the latest version (fly version update, I think), then try

fly wireguard websockets enable

… and having done that, then try both fly doctor and also your fly ssh console again. See if that fixes it or at least returns a different error.

I tried that but also the same result. But I found out that the problem is the ams region. If I do fly wireguard create org fra it works but the same command with ams does not work. Where should I report this issue?

Ans also is it possible to configure flyctl to use a different region? It is possible using the FLYCTL_WG_REGION environment variable. I ran export FLYCTL_WG_REGION=fra and the ssh and fly doctor are working now.

Glad you got it working. Weird about ams.

People from Fly do respond on these forums so one of them will spot your issue. So I don’t think you need to actively report it.

1 Like

Ran into the same problem (with latest flyctl v0.1.72 on Linux amd64) when trying to flyctl ssh console:

Error: ssh: can't build tunnel for [org]: EOF

In my case, a flyctl wireguard reset [org] resolved the issue.

I can’t even do this.

Error: upstream service is unavailable

:pensive: