ruby-on-railsairbrake

Rails airbrake undefined method


I was running my rails application and it was working fine till yesterday but today when i run rails server it is giving me this error.Though my airbrake is also dont have any errors
[airbrake.rb]

Airbrake.configure do |config|
  config.api_key = APP_CONFIG.airbrake.api_key
  config.host    = APP_CONFIG.airbrake.host
  config.port    = APP_CONFIG.airbrake.port
  config.secure  = config.port == 443
end


undefined method `api_key=' for #<Airbrake::Config:0x000000073fa1e0> (NoMethodError)
  from /home/techbirds/.rvm/gems/ruby-2.2.3/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby.rb:98:in

configure' from /home/techbirds/icare-master/config/initializers/airbrake.rb:1:in ' from /home/techbirds/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in load' from /home/techbirds/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:inblock in load' from /home/techbirds/.rvm/gems/ruby-2.2.3/gems/activesupport-


Solution

  • It looks like you have inadvertently upgraded to the new v5 Airbrake gem. You can either:

    1. follow the migration guide to migrate from airbrake v4 to v5, or
    2. lock airbrake to v4, in the gemfile, e.g. something like gem 'airbrake', '~> 4.3.4'