Make Your Logs Work for You

The days of logging in to servers and manually viewing log files are over. SolarWinds® Papertrail™ aggregates logs from applications, devices, and platforms to a central location.

View Technology Info

FEATURED TECHNOLOGY

Troubleshoot Fast and Enjoy It

SolarWinds® Papertrail™ provides cloud-based log management that seamlessly aggregates logs from applications, servers, network devices, services, platforms, and much more.

View Capabilities Info

FEATURED CAPABILITIES

Aggregate and Search Any Log

SolarWinds® Papertrail™ provides lightning-fast search, live tail, flexible system groups, team-wide access, and integration with popular communications platforms like PagerDuty and Slack to help you quickly track down customer problems, debug app requests, or troubleshoot slow database queries.

View Languages Info

FEATURED LANGUAGES

TBD - APM Integration Title

TBD - APM Integration Description

TBD Link

APM Integration Feature List

TBD - Built for Collaboration Title

TBD - Built for Collaboration Description

TBD Link

Built for Collaboration Feature List

Tips from the Team

Heroku: Most Common Errors Explained

START FREE TRIAL

Fully Functional for 14 Days

Last updated: January 22, 2024

The allure of quickly spinning up an app on a platform as a service (PaaS) instead of cobbling together a solution on an infrastructure as a service (IaaS) makes Heroku an appealing option for many developers. With the explosive growth in the platform as a service market, new features and capabilities are continually rolling out. Along with the fast-paced evolution of Heroku comes an increase in complexity, which can create challenges for application developers.  

Even if you’re a seasoned developer with extensive experience with Heroku, there are some common errors you can run into.  

Most errors are easy to resolve, thanks to the Heroku community. There comes a point when routine searches (of Stack Overflow and a black belt in Google) fall short. We’ll discuss the errors not covered in the newsletters or changelogs.  

Let’s dive into a few errors linked to Heroku updates.  

Heroku Updates 

Looking at Heroku updates (since they’re more likely to give rise to Heroku errors), these three stand out:  

1. Improved security for PostgreSQL database  

2. Heroku’s first build fails  

3. New versions of supported languages available (like Go 1.16x)  

Let’s look at the conditions that can result in these Heroku errors.  

Improved Security for PostgreSQL 

Even with the managed PostgreSQL service from Heroku, you may find yourself using a third-party tool to connect to your databases. This situation is common when you have a growing number of databases. It’s especially likely when you consider the tools and extensions (in other words, the capabilities) with tools like pgAdmin.  

Because you’re managing a lot of databases, you may have neglected the need for SSL when connecting to your Heroku provisions. The result may be an error that looks something like this:  

FATAL: no pg_hba.conf entry for host "yourhost", user "usn", database "dbID", SSL off

Heroku First Build Fails 

The most common occurrence of this error is on the Heroku-16 stack. Behind the scenes, it’s a Linux kernel build that is now unsupported. With Ubuntu 16.04 LTS, deprecated, you may have had an app running smoothly since April 2016) now giving you build errors.  

This will happen just once. While your build works the second time as well as any other trials you’ll run, the one fail should make you pause and think.  

New Versions of Go Causing Heroku Errors 

With Go 1.16rc1, new builds can fail for one of two reasons.  

First, additional packages you used to append and run successfully unexpectedly fail. The failure usually asks you to get the same package you’re trying to install to your build. A quick example looks like this:  

no required module provides package github.com/(your/package/repo/dir); to add it: go get github.com/(your/package/repo/dir)

I’ll explain the error in a moment. There’s another Heroku error common with new Go versions: the bin/test glitch. It looks like this:  

Understanding Heroku Errors 

When such errors happen in Heroku, a managed services provider, you’re probably not the only one suffering. There are many ways to investigate these type of errors. The most common is through Google and Stack Overflow. One often leads to the other.  

However, for errors that come from new updates, the best course of action is to read about Heroku errors in the developer community that works most closely with the platform.  

Here are the errors as other developers commonly research them:  

  1. Can’t connect to Heroku Postgres with [insert third-party client here] 
  1. What is application error 503 on Heroku? 
  1. What is application error H10? 
  1. Heroku build failed, but it works on localhost 
  1. Heroku Go 1.16x build failed 

Here’s why these Heroku errors happen and how to solve them.  

Your stack plays a key part in how you implement this advice. I’ll assume you’re using the latest instances and packages for your preferred development language.  

1. Can’t Connect to Heroku PostgreSQL With [Client Name]

This error happens because Heroku updated its db_connect requirements to include SSL as a default. This update blocks clients who previously connected without SSL.  

Chances are, you’re infusing security in line with code whenever you’re connecting to your PostgreSQL database. And that’s good! However, it helps to have every authentication variable set to on or auto (depending on your client), so Heroku passes your connections with SSL. If you fail to enable this, you can cause other errors down the line, such as OOM hangs. 

Let’s solve the issue for a group of devs connecting with a popular client, pgAdmin 4. This problem disappears when you alter the SSL settings.  

One thing to keep in mind when you create a server now is to make sure you “require” rather than “allow” the SSL mode. This simple tweak makes the option global for every connection created on this server.  

2. Heroku Build Failed, But It Works on Localhost

Your localhost may not be aware of the LTS choke imposed by Heroku. That’s why when you export your project into a Heroku instance, it fails the first time. This happened until Ubuntu 16.04 stopped receiving support in 2021. To avoid this, update your stack to any later deployment of Linux and Heroku. The LTS choke was removed in Heroku 18 because Heroku now uses a more modern deployment system that allows it to support a wider range of Linux distributions.  

A quick fix starts with upgrading your stack. With failover and service level agreements (SLAs) in mind, it’s safer to use a review app to sample your products on the desired stack before migrating to it. To do this, add the following snippet of code to your app.json file:  

{
 
   "stack": "heroku-xx"
 
}

This loads your app for testing on the specified stack. Alternatively, you could navigate to your app’s root and then execute the following command:  

$ heroku create --remote heroku-xx --stack heroku-xx < app_name >

This creates a new dir in your repo, appends it with the stack number you preferred, and makes a copy of your app available for testing. If your app crashes, any commits you make to bring it back to life won’t affect the original app’s subfolder. Safety first!  

3. What Is Application Error 503 on Heroku? 

From the knowledge of HTTP status codes, 503 indicates that service is unavailable. This means that the Heroku web server cannot handle any request at the moment. When you get this error in Heroku, some of the notorious reasons may include application crashes, dynos not running, resources exhausted, or maintenance. Therefore, to pinpoint the exact reasons, you have to check and analyze the logs. The logs will give you a clue as to what’s causing the issue. You can do this by running heroku logs –tail.  

4. What Is Application Error H10? 

Error H10 is a general error that signals that an app has crashed. As a result, all requests will fail until you resolve the issue. Some things that may cause the crash may include but are not limited to misconfiguration, failed deployment, or dependency issues. To find out the cause, refer to the logs and also do a backtrack of recent changes and configurations.  

5. Heroku Go 1.16x Build Failed 

Two issues have recently caused headaches for developers. Luckily, there are several workarounds for each case. You can resolve the first error (package load fails) by adding a forceful install through a tools.go package to your app. Alternatively, you can explicitly mention @latest at the end of your package dir, which should have matching changes applied to your version of Go. Heroku supports Go from version 1.14 onwards.  

The bin/test error itself asks for an explicit mention of the version you want. Once it’s specified, you should be good to go.  

How to Interpret Heroku Errors

Some changes to policies on the Heroku side can result in errors. Ubuntu 16.04 LTS is one such case, but it’s not the only one. When these happen, it helps to have log analyzers in place to quickly identify and diagnose Heroku errors. This is where a log management tool like SolarWinds® Papertrail comes in handy.  

Papertrail can aggregate logs from many different tools and systems (including Heroku, PostgreSQL, and Go). With the ability to search across all your log files from single search bar, SolarWinds Papertrail makes debugging even easier. Papertrail allows you to get alerts instantly when errors are detected. You can also search thousands of log entries in seconds or follow real-time tail logs. With Papertrail, you can monitor your entire application stack on Heroku, identify issues early, and avoid downtime. You can sign up for the free trial here or get an online quote.    


This post was written by Taurai Mutimutema. Taurai is a systems analyst with a knack for writing, which was probably sparked by the need to document technical processes during code and implementation sessions. He enjoys learning new technology and talks about tech even more than he writes.

Aggregate, organize, and manage your logs

  • Collect real-time log data from your applications, servers, cloud services, and more
  • Search log messages to analyze and troubleshoot incidents, identify trends, and set alerts
  • Create comprehensive per-user access control policies, automated backups, and archives of up to a year of historical data
Start Free Trial

Fully Functional for 30 Days

Let's talk it over

Contact our team, anytime.