Adding Error Monitoring to Rails on Heroku with Airbrake


Once you start running web services on a test, staging, or production server, it’s important to keep an eye on errors and exceptions.

Several solutions exist for this - your choices depend on which technology stack you use, and where you host. I prefer to host my Rails applications on Heroku, as it’s very easy to update the servers from my command line. Heroku has add-on partners in its ecosystem, so that you don’t have to set up separate accounts and billing with each and every provider. Looking through the options, I decided to try Airbrake, as they had a reasonable free tier plan I could use for development and testing.

I followed the instructions on Heroku’s DevArticle - the only thing that didn’t work was the next to last step:

rails g airbrake

The Rails generator for Airbrake was supposed to load my project configuration information from Heroku’s config, but that didn’t work.

I had to manually specify my Airbrake Project ID and API Key:

rails g airbrake <project-id> <api-key>

So try that out if you have issues following the install - it was easy enough to figure out, and the instructions on Airbrake’s site also worked for me, by showing the command line arguments.

I’ll follow up on this post once I see more of how it works on Heroku - I may end up sticking with Airbrake, or trying something else out.