Error reading server preface: EOF

I’ve deployed temporal/auto-setup and temporal/ui in AWS ECS + Fargate cluster. In the temporal/ui container, I set TEMPORAL_ADDRESS=temporal:7233 env var.

I’ve also setup AWS Cloud Map, so temporal/ui can reach temporal server through temporal:7233 dns name.

I can verify that the temporal/ui container can reach temporal:7233 using the following command:

ip-10-0-0-198:/home/ui-server# nc -z -v temporal 7233
temporal (xxx.xxx.0.2:7233) open

I can also ping:

ip-10-0-0-198:/home/ui-server# ping temporal
PING temporal (xxx.xxx.0.2): 56 data bytes
64 bytes from xxx.xxx.0.2: seq=0 ttl=127 time=0.041 ms
64 bytes from xxx.xxx.0.2: seq=1 ttl=127 time=0.163 ms

However, when I try to call curl -v http://localhost:8080/api/v1/namespaces/default from within the temporal/ui container, it looks like it fails to call the temporal server (I’m assuming):

{
  "code": 14,
  "message": "last connection error: connection error: desc = \"error reading server preface: EOF\""

Verbose curl log:

ip-10-0-0-198:/home/ui-server# curl -v http://localhost:8080/api/v1/namespaces/default
* Host localhost:8080 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET /api/v1/namespaces/default HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 503 Service Unavailable
< Content-Type: *
< Set-Cookie: _csrf=LFWayzP6chEO3SRHqjzor4JmOlLHinzO; Path=/; Expires=Thu, 09 Jan 2025 20:13:05 GMT; Secure; SameSite=Strict
< Vary: Accept-Encoding
< Vary: Origin
< Vary: Cookie
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-Xss-Protection: 1; mode=block
< Date: Wed, 08 Jan 2025 20:13:05 GMT
< Content-Length: 118
<
{
  "code": 14,
  "message": "last connection error: connection error: desc = \"error reading server preface: EOF\""
* Connection #0 to host localhost left intact
}ip-10-0-0-198:/home/ui-server#

What’s happening? What is that error? Any insights to troubleshoot?

1 Like

error reading server preface: EOF

most of time that have seen this had to do with tls issues with certs.

ip-10-0-0-198:/home/ui-server# nc -z -v temporal 7233
temporal (xxx.xxx.0.2:7233) open

can you use Temporal cli to check cluster health?
temporal operator cluster health

The cluster is healthy.

The issue was the BIND_ON_IP configuration. This env var is not documented as available in the temporalio/auto-setup container and yet it’s required to be set to 127.0.0.1 otherwise grpc connections to the cluster will fail with the error above.

are you using default static config template or defining your own static config manually?
it defaults to 127.0.0.1 in template, see for example here

I’m not defining anything manually. Whatever the auto-setup does, I’m not touching it.

That’s weird because the only thing that worked for me, was to manually set the BIND_ON_IP env var to 127.0.0.1, otherwise this line would choose an available IP from the host.

otherwise this line would choose an available IP from the host

good point as entrypoint would set the env var thats later on used by dockerize when creating static config from template. can you run getent command that entrypoint does and see if it gives you same result?