Knowledgebase

How to Troubleshoot Apps in App Platform Print

  • 0

How to Troubleshoot Apps in App Platform

Review build and runtime logs

View the logs for your application to see if any exceptions or errors were thrown.

Consult the Error Reference

Check any errors that show up in your logs against the error reference for further explanation.

Review Any Limits or Usage Details for Your Programming Language

Look up the details for your programming language by browsing to the Languages and Frameworks page and look for any details under the headings Usage and Limits.

Check the “Insights” for Your App for Spikes

Insights are graphical charts showing your resource use. If your CPU, memory, or bandwidth usage is unexpectedly high, you could be experiencing unintended side-effects and low performance. Navigate to your app in the control panel and click the Insights tab to investigate.

An app that is running out of memory may not show clear signs of a problem. The memory graph may never approach 100% use, for example, if your app is quickly exhausting memory and rebooting on startup. In this case, the Restart Count metric could be a more useful indicator. If your app’s Restart Count graph shows that restarts are occurring, and you have minimal application log output, it is possible that the app is repeatedly rebooting due to memory constraints. Ensure that the instance size will provide sufficient memory for the application and consider testing with a larger size to eliminate memory exhaustion as a possible cause.

See the Results of Your Last Health Check

Health checks should be configured for any publicly-accessible service that is running as part of your app. If a health check is failing, that means that external traffic is not reaching your service at the expected HTTP route.

Redeploy

A redeploy of your app can help get you past the rare case where there was a transient issue with App Platform itself, and force a check on GitHub for the latest code commit that may contain your fix.

Inspect your App Spec

The app spec can show you the complete topology of your app in one manifest, which may reveal problems. To download the App Spec for your app, go to the Settings tab for your app, and click the View link.

Console in to Your Resource

You can use the App Platform console to give you the shell for your app’s container. From here you can execute any bash commands that you think might help investigate the issue.

Ensure Access to Your Database

Use the connection details in the cloud control panel with database software such as MySQL Workbench, to verify that your database is live and connectable. If it seems to be running, check the following:

  • Are your connection parameters defined correctly? If you add a managed database as a resource of your app then App Platform will automatically create a DATABASE_URL environment variable for you that contains the connection string.
  • Are your database’s connections unrestricted? App Platform cannot connect to a database that has restricted connections or trusted sources configured, even if that database is managed by Rcs.is.

If you’re still having trouble, the supported engines for Rcs.is databases have Support pages, like this one for MySQL that are good to consult.

Echo Debug Information

Anything that you print to the STDOUT stream in your code will be captured in the logs for your app, which can give you a crucial picture into the state of your app at the time of failure. This is true for both build-time output and runtime output.

Review GitHub Permissions

Configure your GitHub permissions so that Rcs.is is installed on your account, and grant Rcs.is Repository access for the repos that contain the source code you’d like to ship, leaving all other settings on default.

Check for a Misconfigured Port or Network Interface

App Platform expects that any service you deploy will listen on all interfaces on port 8080 (0.0.0.0:8080). If you cannot modify your service’s code to listen on port 8080, you can change the HTTP Port setting during the initial app creation process or on the resource details page of your service. If you’re configuring your application using the app spec, you can use the http_port key or the PORT environment variable to configure App Platform to expect your service on a different port. If you set both the http_port key and the PORT environment variable, the service uses the http_port value and the PORT value remains available for other configuration, such as for a database port.

For convenience, App Platform sets an environment variable named PORT in your runtime environment that contains the expected port number for your service to listen on.

If the Build Was Skipped, Consult Earlier Logs

Sometimes when viewing the details of a deployment you will see the message “The build was skipped for this deployment” and no build logs will appear. This happens when App Platform was able to save time by re-using the results of a previous build (i.e. when nothing about your app’s containers underwent a significant change).

To see the current build logs for this application, look back in your app’s Deployment History until you find the most recent Deployment with non-empty build logs.

Common Pitfalls

HTTP Port configuration

Some apps set the listening port using the PORT environment variable, while others are hardcoded. In the scenario that an app uses PORT to determine the HTTP server port, the HTTP Port field in app’s Settings tab overwrites any PORT environment variables that are set in the app.

If an app’s HTTP port is hardcoded, the HTTP Port for that component needs to be changed in the Settings tab to match the app’s value.

HTTP Serving on localhost vs 0.0.0.0

HTTP servers explicitly running on localhost or 127.0.0.1 creates a common issue. This is problematic because localhost is an alias for 127.0.0.1, which is a local loopback interface that is not externally exposed to the current environment.

HTTP servers should not include an address specifying 0.0.0.0 explicitly, or using the process.env.PORT.


Was this answer helpful?
Back

Powered by WHMCompleteSolution