Rails airbrake undefined method
Asked Answered
R

3

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-

Rambling answered 24/12, 2015 at 9:30 Comment(0)
H
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'
Hackney answered 24/12, 2015 at 9:48 Comment(0)
B
2

Have you check the Migration guide on the github repo?

Old option | New option  | required?
api_key    | project_key | required
.......    | ........... | ........
Berny answered 24/12, 2015 at 9:43 Comment(2)
not working getting the same error undefined method `project_key' for #<SimpleConfig::Config:0x00000007d8c4b0> (NoMethodError)Rambling
The SimpleConfig class/module has nothing to do with Airbrake.Rabelais
A
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

Assentation answered 24/12, 2015 at 9:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.