Honeybadger has great built-in support for Heroku, including automated deployment tracking and monitoring of Heroku platform errors.
There are two ways to use Honeybadger with Heroku: via our Heroku add-on, and via a regular Honeybadger account. Each has its own unique strengths.
- Heroku Add-On: When you purchase the Honeybadger add-on through the Heroku marketplace, you’re buying access for a single project and a single user. If this is all you need, the Heroku add-on can be super convenient. But if you have several users managing errors for multiple projects, it can be a hassle…not to mention more expensive.
- “Regular” Honeybadger Account: If you’ve signed up for a Honeybadger account via our website, good news! You still have access to all our Heroku-related features. We’ll cover how to set that up below. You’ll also get a plan that allows multiple projects and multiple users.
If you are currently a Heroku add-on customer and would like to switch to a “regular” account, we can do that. Just email us at email@example.com.
With deployment tracking, Honeybadger is notified when you deploy your app. It’s optional, but enabling it lets you do some really cool things, like:
- Send alerts to Slack whenever your project is deployed.
- Automatically resolve errors on deployment, so that any new occurrences after deployment will send you a new notification.
- See which errors occurred after which deployments.
It’s super easy to set up deployment tracking for your Heroku apps. Just run the following command, making sure to add your Honeybadger API key at the end:
$ heroku webhooks:add -i api:release -l notify -u "https://firstname.lastname@example.org/username/projectname&environment=production&api_key=asdf" --app app-name
If you’re using our Ruby gem, you can use the
honeybadger command line tool to do the same thing:
bundle exec honeybadger heroku install_deploy_notification
If you’re a Heroku add-on customer, platform error monitoring may already be set up. To check, run
heroku drains -a APP_NAMEand see if it mentions Honeybadger or “logplex.honeybadger.io”. If it does, you don’t need to set anything else up.
Normally, Honeybadger only sees errors that happen inside your application. On Heroku, we’re able to go one step farther and monitor platform errors. These include the dreaded H12 timeouts and R99 errors you may have seen in your Heroku logs.
To capture these errors we use Heroku’s log drain feature. Each line of your logs is sent to our servers in the background. We pull out the errors and throw everything else away.
To add the log drain, run the following command, replacing API_KEY with your Honeybadger project’s secret token and APP_NAME with the name of your Heroku app:
heroku drains:add https://logplex.honeybadger.io/heroku/v1?api_key=API_KEY -a APP_NAME
To monitor different environments in the same Honeybadger project, add the
env parameter to the log drain endpoint, i.e.:
heroku drains:add https://logplex.honeybadger.io/heroku/v1?api_key=API_KEY&env=production -a APP_NAME