App is not listening on the expected address

It’s been a couple years since I updated ports for one of my apps and I’ve honestly forgotten if this is the correct configuration.

On each deploy I’m getting an

"WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
  - 0.0.0.0:8080
Found these processes inside the machine with open listening sockets:
  PROCESS        | ADDRESSES
-----------------*---------------------------------------
  /.fly/hallpass | [IPV6]:22

error and wasn’t sure if it’s something I need to worry about.

Below is the fly.toml for the app:

# fly.toml app configuration file generated for eirene-bot on 2024-09-30T12:51:33-04:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'APPNAME'
primary_region = 'ord'
kill_signal = 'SIGTERM'
kill_timeout = '15s'
swap_size_mb = 256

[experimental]
  auto_rollback = true

[build]

[deploy]
  strategy = 'rolling'

[env]
  PORT = '8080'

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[services]]
  protocol = 'tcp'
  internal_port = 8080
  auto_start_machines = false
  processes = ['app']

  [[services.ports]]
    port = 80
    handlers = ['http']
    force_https = true

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

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

  [[services.tcp_checks]]
    interval = '15s'
    timeout = '2s'
    grace_period = '1s'

[[vm]]
  size = 'shared-cpu-1x'
  memory = '256mb'

Is this something I should fix? The node app currently has a env variable to set the listening port:

let port = process.env.PORT;
if (port == null || port == "") {
  port = 3000;
}

Any advice would be greatly appreciated. Please let me know if you need any other snippets

You have both http_service and services on the same port… pick 1

1 Like

Thanks to @khuezy for the solution

Looks like the problem was flyctl adding a second http service block in the TOML file.

Below is a working version of the file


app = 'APPNAME'
primary_region = 'ord'
kill_signal = "SIGTERM"
kill_timeout = 15
swap_size_mb = 256
processes = []

[build.args]
NODE_ENV = "production"

[env]
  PORT = "8080"
  
[experimental]
  allowed_public_ports = []
  auto_rollback = true

[deploy]
  strategy = "rolling"

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

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

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

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

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

[[vm]]
  size = "shared-cpu-1x"
  memory = "256mb"