7

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-

Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103
aniket tiwari
  • 93
  • 1
  • 10

3 Answers3

17

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'
zefer
  • 558
  • 3
  • 9
2

Have you check the Migration guide on the github repo?

Old option | New option  | required?
api_key    | project_key | required
.......    | ........... | ........
Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103
0

It seems that you did not lock airbrake's major version in Gemfile like this:

gem 'airbrake', '~> 4.3'

5th version introduced api changes which you're encountering. I'd suggest using above version lock for a quick fix, and then do a migration as described in guide

Vasfed
  • 18,013
  • 10
  • 47
  • 53