Not able to run express-gateway on heroku - failed to bind to $PORT

71 Views Asked by At

I'm trying to have the basic example express-gateway running on Heroku

    http:
      port: ${HTTP_PORT:-8080}
      hostname: ${HOST:-localhost}
    admin:
      port: 9876
      host: localhost
    apiEndpoints:
      api:
        host: 'localhost'
        paths: '/ip'
    serviceEndpoints:
      httpbin:
        url: 'https://httpbin.org'
...

Looking the logs I got the following error:

2021-02-15T18:53:09.947569+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Any ideas?

1

There are 1 best solutions below

0
On

I managed to fix that with the following config:

http:
  port: ${PORT:-8080}
https:
  port: ${PORT:-8081}
admin:
  port: 9876
apiEndpoints:
  api:
    paths: '/ip'

So the default port variable is called PORT and by removing all references to localhost