Read application logs and investigate server errors
Find out why a deployed application does not start or returns an error.
In this guide
When to use application logs
Use application logs when the build has completed but the website does not respond, login fails or a request returns an error. The content depends on what your application writes to its log.
Reproduce and investigate the problem
- Open the website and Logs. The view shows the application's latest 500 log lines.
- Note the time and URL of the problem. Reproduce the failing action once.
- Select Refresh to load new lines. Match the event time to the log, allowing for possible time-zone differences.
- Check whether the error concerns a missing environment variable, database connection, permission or application code.
- Correct the cause you identified. Saving a variable starts a new deployment; a code fix must be pushed to GitHub and deployed.
Verify the result
Repeat the same user action and refresh the log again. Check the website status and latest deployment as well. An empty log alone does not mean there is no error: the application may not log that event.
Narrow down 502 and connection errors
Check startup errors and ensure the application listens on the port supplied in the hosting PORT variable, rather than only accepting localhost connections. Check database status and website memory usage. Do not delete the application as a troubleshooting step. If the cause remains unclear, send support the event time and a log excerpt with secrets removed.
