Notifications working in production, but not in staging or development environments.

food52's Avatar

food52

12 Sep, 2012 04:16 PM

I'm running the airbrake-3.0.2 gem with Rails 3.2.5 and Ruby 1.8.7.

Aibrake seems to be collecting errors in my production environment, but I can't get it to do so in my staging or dev environments. (I want the latter so that I can be confident Airbrake is catching errors properly.)

The rake airbrake:test task works properly in all environments. config.action_controller.consider_all_requests_local is set to false in all environments. I have reviewed the troubleshooting guide and tried the suggestions there, to no avail.

Errors in the dev environment produce a stack trace like this one:

HTTP_X: 
CAUGHT A 500 ERROR AND RENDERING A 500

RuntimeError (Michael is awesome.):
  app/controllers/home_controller.rb:13:in `index'
  haml (2.2.3) lib/sass/plugin/rails.rb:19:in `process'
  airbrake (3.0.2) [v] lib/airbrake/rack.rb:27:in `call'
  airbrake (3.0.2) [v] lib/airbrake/user_informer.rb:12:in `call'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:82:in `start'

Airbrake seems to be consulted, but no notification is produced. Any idea what's going on here?

  1. Support Staff 2 Posted by Morgan on 12 Sep, 2012 11:44 PM

    Morgan's Avatar

    Hi,

    Please try adding

    config.development_environments = []
    

    To your config block in config/initializers/airbrake.rb
    That should enable logging for all environments.
    Also We released airbrake gem version 3.1.4 which has more features and bug fixes.
    That makes it a good time to run bundle update airbrake
    Please let me know how it goes!

    From,
    Morgan

  2. Morgan closed this discussion on 12 Sep, 2012 11:44 PM.

  3. Morgan re-opened this discussion on 12 Sep, 2012 11:44 PM

  4. Support Staff 3 Posted by Morgan on 12 Sep, 2012 11:47 PM

    Morgan's Avatar

    Oops, 3.1.4 does not support your version of rails. Please disregard the upgrading message. :)

  5. 4 Posted by food52 on 13 Sep, 2012 02:01 PM

    food52's Avatar

    Hi, Morgan. This didn't seem to make a difference.

    Here's my config/initializers/airbrake.rb:

    Airbrake.configure do |config|
      config.api_key = [MY KEY]
      config.development_environments = []
    end
    

    Here's the trace:

    HTTP_X: 
    CAUGHT A 500 ERROR AND RENDERING A 500
    
    RuntimeError (Michael is the King of all Errors.):
      app/controllers/home_controller.rb:13:in `index'
      haml (2.2.3) lib/sass/plugin/rails.rb:19:in `process'
      airbrake (3.0.2) [v] lib/airbrake/rack.rb:27:in `call'
      airbrake (3.0.2) [v] lib/airbrake/user_informer.rb:12:in `call'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:162:in `start'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:95:in `start'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:92:in `each'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:92:in `start'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:23:in `start'
      /Users/hoffm/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:82:in `start'
    
  6. 5 Posted by food52 on 14 Sep, 2012 05:03 PM

    food52's Avatar

    It also appears that not all 500s are being captured by airbrake even in production, though as you can see by looking at my account, some are. I'd appreciate any guidance you might have.

  7. 6 Posted by food52 on 17 Sep, 2012 05:28 PM

    food52's Avatar

    Hey, Morgan, just wondering of you have any further guidance for me here. I'd love to get Airbrake up and running.

  8. Support Staff 7 Posted by Morgan on 20 Sep, 2012 12:41 AM

    Morgan's Avatar

    Hi again!

    Not all 500 errors will show up. ActiveRecord::RecordNotFound is ignored by default.
    you can see what errors are ignored by default by booting up the rails console for your environment and running Airbrake.configuration.ignore you can also chose to report on every error if you set the following in your config/initializers/airbrake.rb

    config.ignore_only = []
    

    You can customize the airbrake.rb in other ways as well.

    By default these are ignored:

    AbstractController::ActionNotFound
    ActiveRecord::RecordNotFound
    ActionController::RoutingError
    ActionController::InvalidAuthenticityToken
    ActionController::UnknownAction
    CGI::Session::CookieStore::TamperedWithCookie
    

    Please let me know if this does not clear things up. Happy to dive deeper into this if needed.

    From,
    Morgan

  9. 8 Posted by Michael Hoffman on 20 Sep, 2012 08:37 PM

    Michael Hoffman's Avatar

    Morgan, as you can see from the trace above, the intentional error I'm using for testing is a simple RuntimeError. This is caused by raise "some string" in the application controller.

    I have also tested with other error types, being careful o avoid those in the ignored list.

  10. Support Staff 9 Posted by Morgan on 24 Sep, 2012 02:21 AM

    Morgan's Avatar

    Hi Michael,

    I found the last piece of this puzzle, to report upon 500 errors in the environments other than production you have to adjust 2 things:

    1 add the following line in config/initializers/airbrake.rb

    config.development_environments = [] 
    // Reports on all environments
    

    2 In config/environments/development.rb change config.consider_all_requests_local from true to false

    config.consider_all_requests_local = false 
    // Shows prod style  errors in prod
    

    I was able to replicate and solve the problem like this! Please confirm with me that it works for you as well!

    From,
    Morgan

  11. 10 Posted by Ryan on 18 Feb, 2013 07:34 PM

    Ryan's Avatar

    Hello, we are currently revisiting tickets that seem that have been resolved. If you have any further questions let us know. Send an Email to
    [email blocked].

    Thanks,
    Ryan

  12. Ryan closed this discussion on 18 Feb, 2013 07:34 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac