Bugsnag lets you know which exceptions are happening most frequently, which
users are affected, and what kinds of inputs cause problems. We notify you by
email, hipchat or campfire the first time an exception happens and include
enough information that you can find and fix bugs quickly and easily. We also
integrate with bugtrackers and project management tools like Github Issues,
Pivotal Tracker and JIRA so that your entire team can see what needs to be
fixed.

Bugsnag is accessible via an API and has supported client libraries for Ruby,
Python, Node.js, Java, and many other languages.

Once Bugsnag has been added a BUGSNAG_API_KEY setting will be available in
the app configuration and will contain the api key needed to talk to the
bugsnag API. This can be confirmed using the heroku config:get command.

$ heroku config:get BUGSNAG_API_KEY
70d9b0852a968b1d0d0e329b5507f287

Most of the Bugsnag client libraries will automatically read this environment
variable and will start sending unhandled exceptions to Bugsnag as soon as they
are deployed.

Local setup

Environment setup

If you want to test Bugsnag in development you need to export the same BUGSNAG_API_KEY
as we have provisioned in production.

Use the Heroku Local command-line tool to configure, run and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a .env file. To view all of your app’s config vars, type heroku config. Use the following command to add the BUGSNAG_API_KEY values retrieved from heroku config to your .env file.

$ heroku config -s | grep BUGSNAG_API_KEY >> .env
$ more .env

A slightly less portable way of achieving the same thing is to just
export BUGSNAG_API_KEY=value in a terminal before starting your app.

Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env file with: echo .env >> .gitignore.

Dashboard

For more information on the features available within the Bugsnag dashboard please see the docs at bugsnag.com/docs.

The Bugsnag dashboard allows you to see which exceptions are currently
affecting your app, how frequently, and how severely. You can use it as a
debugging tool for finding out what conditions cause exceptions, a todo list
for prioritizing which bugs to fix, or a status page that gives you a feel
for how buggy or not your app is.

The dashboard can be accessed via the CLI:

$ heroku addons:open bugsnag
Opening bugsnag for sharp-mountain-4005…

or by visiting the Heroku Dashboard and selecting the application in question. Select Bugsnag from the Add-ons menu.

Troubleshooting

If you do not seem to be seeing any exceptions in Bugsnag, it’s worth checking
that you have installed the notifier library and it is configured correctly.

For rails apps this can be done by running our rake task.

$ heroku run rake bugsnag:test_exception

For other apps, just add a manual Bugsnag notification call to your app.