When i request gRPC server can't reach my app "Error: app refused connection"

Deployed simple gRPC Server and when i request gRPC method show this error message.

2022-09-16T15:33:04.497 proxy[74c64dbf] hkg [error] Error: app refused connection

this is my fly.toml file and this app is working on local development.
I think request can’t reach gRPC server and request is dropped fly.io proxy server.

app = "myapp(not real name)"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
  SERVICE_NAME = "myapp(not real name)"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

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

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

  [services.ports.tls_options]
    alpn = ["h2"]

I have a working gRPC deployment.

The only (evident) difference between our TOML files is that I have:

  [[services.ports]]
    handlers = ["tls"]
    tls_options = {"alpn" = ["h2"]}
    port = "443"

Hi Seapy, another thing to try is fly ssh console into the instance running your application, and verify you can make requests to 0.0.0.0:8050. If that’s not working, it may mean that your application is listening on the lo interface, which won’t receive traffic.

If that’s the case, you’ll likely need to change something about how your application starts to ensure it is binding to the public interface and port 8050. In a go grpc application, for example, you’d want to make sure to call something like net.Listen("tcp", "0.0.0.0:8050").

2 Likes

Thank you, but this is not changed my problem

My code is net.Listen("tcp", ":8085")
i will try fly ssh console

Thanks

I believe it instead should be: net.Listen("tcp", ":8050") since services.internal_port is 8050 according to the config toml you have originally shared.

2 Likes

Oh! you’re right.

This is my mistake.
App use port 8085 but fly.toml use 8050.

Problem solved. Thanks