Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Airbrake::Error: the 'default' notifier isn't configured" thrown after unsuccessful specs #28

Closed
rafaelgonzalez opened this issue Jan 14, 2016 · 2 comments · Fixed by #32
Labels

Comments

@rafaelgonzalez
Copy link

  • Airbrake version: 5.0.2
  • Airbrake-ruby version: 1.0.2
  • Ruby version: 2.2.3
  • Framework name & version: Rails 4.2.5

Airbrake config

Airbrake.configure do |config|
  config.project_id = 'foo'
  config.project_key = 'bar'

  config.environment = Rails.env
  config.ignore_environments = %w(development test)
end

Description

I am getting an error when using rake tasks, specifically: Airbrake::Error: the 'default' notifier isn't configured

This happens when RSpec's rake task exits because of a failing spec. This does not happen when specs succeed.

I'm using the latest version (1.0.2) and I'm not quite sure why #14 does not apply in this case, as it seems to be SystemExit as well.

I removed some irrelevant output from RSpec, but the output I get is this:

$ RAILS_ENV=test rake spec

--Snip--

Finished in 4.02 seconds (files took 2.22 seconds to load)
97 examples, 1 failure

Failed examples:

--Snip--

Randomized with seed 50266

/Users/rafaelgonzalez/.rvm/rubies/ruby-2.2.3/bin/ruby -I/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib:/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/rspec-support-3.4.1/lib /Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
rake aborted!
Airbrake::Error: the 'default' notifier isn't configured
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/airbrake-ruby-1.0.2/lib/airbrake-ruby.rb:282:in `call_notifier'
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/airbrake-ruby-1.0.2/lib/airbrake-ruby.rb:236:in `build_notice'
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/airbrake-5.0.2/lib/airbrake/rake/task_ext.rb:21:in `rescue in execute'
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/airbrake-5.0.2/lib/airbrake/rake/task_ext.rb:19:in `execute'
SystemExit: exit
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/rake_task.rb:84:in `exit'
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/rake_task.rb:84:in `run_task'
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/rake_task.rb:96:in `block (2 levels) in define'
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/rake_task.rb:94:in `block in define'
/Users/rafaelgonzalez/.rvm/gems/ruby-2.2.3/gems/airbrake-5.0.2/lib/airbrake/rake/task_ext.rb:19:in `execute'
Tasks: TOP => spec
(See full trace by running task with --trace)

Adding the Airbrake config to spec_helper.rb does not work. I get the same error there, which exists the specs prematurely, then giving me the error a second time after the rake task has exited.

  • rake spec does not output anything for me when not specifying the environment, that is, it does not run the specs at all, and exits without doing anything. (I suspect this is because RSpec is under the :test group in my Gemfile)
  • bundle exec rspec does not trigger the error when specs fail.
  • bundle exec rake (which runs the specs) does trigger the error when specs fail (this is how I came across this issue in the first place)

Discussion on this issue initially started on #13, but I created an new issue as per @kyrylo's request.

kyrylo added a commit that referenced this issue Jan 18, 2016
Fixes #28 ("Airbrake::Error: the 'default' notifier isn't configured"
thrown after unsuccessful specs)

This fixes issues with the Rake integration. There was a [similar
issue][1] reported a couple of weeks ago. The change presented here
fixes both issues by reraising `SystemExit`, which propagates it and
gets handled by Ruby.

[1]: #13
kyrylo added a commit that referenced this issue Jan 18, 2016
Fixes #28 ("Airbrake::Error: the 'default' notifier isn't configured"
thrown after unsuccessful specs)

This fixes issues with the Rake integration. There was a [similar
issue][1] to a bug with the Rake integration reported a couple of weeks
ago. The change presented here fixes both issues by reraising
`SystemExit`, which propagates it and gets handled by Ruby.

[1]: #13
kyrylo added a commit that referenced this issue Jan 18, 2016
Fixes #28 ("Airbrake::Error: the 'default' notifier isn't configured"
thrown after unsuccessful specs)

This fixes issues with the Rake integration. There was a [similar
issue][1] to a bug with the Rake integration reported a couple of weeks
ago. The change presented here fixes both issues by reraising
`SystemExit`, which propagates it and gets handled by Ruby.

[1]: #13
@rafaelgonzalez
Copy link
Author

Just had a go with the newest version, the issue is fixed 🐛 🔫

Thanks a lot for looking into it @kyrylo 👍

@kyrylo
Copy link
Contributor

kyrylo commented Jan 19, 2016

Happy Airbraking ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants