Heroku Exception Tracking

Typical installation time: 1 minute

Hi there! You've found Honeybadger's guide to Heroku exception tracking. Once installed, Honeybadger will automatically report exceptions wherever they may happen:

  • During a web request
  • In a background job
  • In a rake task
  • When a process crashes (at_exit)

If you're new to Honeybadger, read our Getting Started guide to become familiar with our Ruby gem. For a refresher on working with exceptions in Ruby, check out the Honeybadger guide to Ruby exceptions.

On this page:

Installation

The first step is to add the honeybadger gem to your Gemfile:

gem 'honeybadger'

Tell bundler to install:

$ bundle install

You can configure Honeybadger on your dynos like so:

Note: This last step isn't necessary if you're using our Heroku add-on, as it adds our API key to your Heroku config automatically.

$ bundle exec honeybadger heroku install [YOUR API KEY HERE]

This will automatically add a HONEYBADGER_API_KEY environment variable to your remote Heroku config and configure deploy notifications.

Tracking deployments

To learn more about tracking deployments, see the Tracking deployments section of the Getting Started guide.

Deploy tracking via Heroku is implemented using Heroku's free deploy hooks addon. If you ran the Installation command already, then you should already have deployment tracking installed. Otherwise, to install the addon and configure it for Honeybadger, run the following CLI command from your project root:

$ bundle exec honeybadger heroku install_deploy_notification

If the honeybadger CLI command fails for whatever reason, you can add the deploy hook manually by running:

$ heroku addons:add deployhooks:http --url="https://api.honeybadger.io/v1/deploys?deploy[environment]=production&deploy[local_username]=&deploy[revision]=&api_key=asdf" --app app-name

You should replace the api_key and app options with your own values. You may also want to change the environment (set to production by default).