Error: timeout reached waiting for healthchecks to pass for machine

Good afternoon, everyone! I’d like to start this topic by letting you know that I am still a newbie in this kind of thing, so if I made a rookie mistake or missed something obvious, I apologize.

I am trying to deploy an application I developed on fly.io, but I keep getting this error:

“Error: timeout reached waiting for healthchecks to pass for machine 1781163ef9e038 failed to get VM 1781163ef9e038: Get “https://api.machines.dev/v1/apps/apibranquinho3/machines/1781163ef9e038”: net/http: request canceled”

Upon reviewing the topics, I noticed that there was a similar one (created yesterday) that seems to be related to mine, and the resolution apparently involved changing the port. I updated the port in the “fly.toml” file, ran it again, but still encountered the same error. Checking the logs, I found this error message:

“[error]Health check on port 4200 has failed. Your app is not responding properly. (I think it confirms that I succeeded in changing the port)”

This seems to indicate that I was able to change the port from 3000 to 4200, but it appears that my application is not listening on port 4200, even though it opens when I access “http://localhost:4200/” in the URL. Can you guys help me figure out what might be happening? Is there a way for me to verify which port my app is accepting? Can I add the default port used by fly.io?

Thank you very much for your help, and I apologize for any rookie mistakes again!

I don’t think it’s very important, but in summary, my app is a Node.js application hosted on a database where I can add, modify, and delete tasks as I want. There is also a frontend, but I am currently trying to deploy only the backend.

The app is for educational purposes, hence the disclaimer at the beginning!

Hi @mafre

Do you mind posting the contents of your fly.toml file? Also, can you confirm the port that your nodejs app is listening on?

Hi! thanks for replying!

Of course, tell me if you need something more

If the latest print doesn’t provide evidence of the port used, how can I check?
To change the port, I only modified the “internal_port” line.

Hi @mafre

Looks like you’re trying to deploy an angular app. Are you running a web server with Angular Server Side rendering? If so, then the listening port would be determined by your web server.

The port specified in the last image is for development only as you are running a local development server, not a proper web server for deploying angular apps.

If you run fly logs you will see more information about what port your app runs on in production, and any errors your app is throwing.

Good afternoon Charley! After conducting a review, I realized that I was executing “fly cptl deploy” on the frontend instead of the backend, which was the wrong approach <:(

Is this the screenshot that shows the port used by my application? I changed it to port 3000 in the fly.toml file, but it still gives the same error. Am I doing something wrong?

Port 3000 looks like the correct port, though looking at your code it’s possible to override it by setting the PORT environment variable.

As @ben-io mentioned, you can take a look at the logs to get more information. You should see a line that says Server Started at followed by a port number.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.