ERR_CONNECTION_CLOSED (problem connecting to app instance)

Hey,

I seem to be getting a constant ERR_CONNECTION_CLOSED and status checks are failing. The application is running as expected internally and can be accessed as expected by CURL through fly ssh console ... curl 127.0.0.1:8080

proxy[31cba3c8] lax [error] Health check status changed 'passing' => 'critical'
Error 2000: problem connecting to app instance

fly status

App
  Name     = backend          
  Version  = 27                      
  Status   = running                 

Deployment Status
  ID          = 1f5a9ac3-1fd2-baa5-2be1-3d2ffde5bfd1               
  Version     = v27                                                
  Status      = running                                            
  Description = Deployment is running pending automatic promotion  
  Instances   = 1 desired, 1 placed, 0 healthy, 0 unhealthy        

Instances
ID              PROCESS VERSION REGION  DESIRED STATUS  HEALTH CHECKS             RESTARTS        CREATED    
d6bfc518        app     27 ⇡    sea(B)  run     running 1 total, 1 critical       0               1m7s ago  
31cba3c8        app     26      lax     run     running 1 total, 1 critical       0               29m51s ago

Dockerfile

...
EXPOSE 8080
ENTRYPOINT ["dockerize", "yarn", "serve"]

fly.toml

app = "backend"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

Any assistance would be greatly appreciated.

Thank you,
Alex

Is your app listening on 127.0.0.1 or 0.0.0.0? That health check is probably failing because the app is only listening on the loopback IP, it needs to listen on public IPs to let us connect.

If this is an express based app, you need to change your listen call to something like this:

app.listen(8080, '0.0.0.0');
1 Like