Failed due to unhealthy allocations

When I am deploying I get the error Failed due to unhealthy allocations

We have a guide to troubleshooting this:

Normally this happens when an app is listening on, or an app is listening on a different port than internal_port in the config.

The error means the app seemed to boot ok, but we couldn’t connect to it with healthchecks.

I have tried that I also tried deleting and remaking the app

Can you post your fly.toml? Also, what language runtime are you using? Deleting and recreating the app won’t fix this, we just need to find the right settings so it can accept network connections from us.

this is my fly.toml

fly.toml file generated for longestlist on 2020-09-10T10:29:55-04:00

app = “longestlist”

builtin = “node”

internal_port = 8080
protocol = “tcp”

hard_limit = 25
soft_limit = 20

handlers = [“http”]
port = “80”

handlers = [“tls”, “http”]
port = “443”

interval = 10000
timeout = 2000

Your app wouldn’t happen to start up and begin loading a long list from another location?

Ideally it needs to open its listening port as soon as possible so that the health checks can succeed.

Otherwise, it’ll not be responding and look unhealthy and be killed off.

also I might want to mention that this was working before and just happened with the app I installed a package. And removing the package made it work again

the package is

so should I put the app.listen at the top of the code instead of after all the app.gets and app.posts

Those aren’t going to take long and are unlikely to block the app from getting to the listener in time.

Quick check, what port is the app listening on?

  1. It works right now put some packages make it come out as unhealthy I was trying to use was ](

3000 is the wrong port. Apps with the node builtin (and most of the builtins) should be listening on port 8080. That’s why it says internal port 8080 in the fly.toml. I just deployed an node app with express-rate-limit and its responding fine over port 8080. Switch your port to 8080 or set it via the environment (we export env PORT 8080 into the node builtin) (use something like

const port= process.env.PORT || 8080;

and then app.listen(port,… later on.

that explains why it is working on 3000 because I have the process.env.PORT || 3000; I will change to 8080 and try the package again