My app deployment failed because of a health check

As an app is deployed, App Platform verifies that its components are healthy by checking their availability on the app’s TCP port (the default port is 8080). If the app is not available on that port, then the health check fails and the app rolls back to the last healthy deployment.

There are two common issues that cause an app to fail a health check:

  • The app starts on a different port than App Platform expects, such as starting on port 3000 when App Platform expects that app to be available on port 8080. You can change the port App Platform uses to perform health checks by editing the http_port field in your app’s spec file and uploading the new app spec.

To edit your app’s spec, navigate to your app’s Overview page and then click the Settings tab. Scroll down to the App Spec section and the click Edit. A preview of the spec opens. Click the Download link at the bottom of the preview window. The spec downloads to your local machine.

Open the spec in a text editor and edit the http_port field to port 8080. Once you have edited the file, save it can close it.

Back in your app’s Settings, click Upload File in the App Spec section. Your machine’s local file manager opens. Select the updated spec file and click Open. The spec uploads to App Platform and triggers a new build.

  • The app’s HTTP server is configured to listen for HTTP requests on address localhost or 127.0.0.1. This is common on NodeJS apps. These addresses use a loopback network interface that is only accessible from within the app’s container and are not accessible to external network traffic.

If your app is configured to listen on a different HTTP endpoint than the app’s root endpoint, you can configure the health checks feature to check your defined endpoint.

To change your app’s health check endpoint, navigate to your app’s Overview page and then click the Settings tab. Select the component that requires the health check and then scroll down to the Health Checks section. Click Edit.

In the Health Check section, click HTTP and then enter the endpoint you want to monitor into the HTTP Path field. Click Save. This automatically trigger a new build.