Capistrano 3 and Airbrake

I was integrating the error tracking app Airbrake on my hobby project Devb.io (which is running Ruby on Rails 4) today and ran into a few problems that was a bit hard to google for - so I put up this blog post in hope of helping someone who has the same problem.

When deploying, i got the following error:

NoMethodError: undefined method `instance' for Capistrano::Configuration:Class

The error lies within the airbrake generator. It assumes that you are using Capistrano 2 instead of Capistrano 3 and the generator adds code to the wrong place.

To fix the error, start by going to deploy.rb and remove the lines added by the generator, they should be near the bottom and and look like this

require './config/boot'
require 'airbrake/capistrano'

Now, add the following line to your Capfile

require 'airbrake/capistrano3'

Now, it should work again! The bug is reported here