I have a standard rails 4 app deployed on heroku.
I'm trying to add bugsnag to it.
First:
- I create a new project in the Bugsnag UI (https://bugsnag.com/accounts/jobteaser/projects/new),
- Select rails,
rails generate bugsnag <API_KEY_FROM_BUGSNAG_UI>
Gemfile
gem 'bugsnag'
config/initializers/bugsnag.rb
Bugsnag.configure do |config|
config.api_key = '<API_KEY_FROM_BUGSNAG_UI>'
end
lib/tasks/test_exception.rake
namespace :myapp do
desc 'Test task that raises an exception'
task :test_exception do
raise 'This is a sample exception'
end
end
- Then I commit, push and deploy with
git push heroku master
- make sure heroku is up-to-date
heroku restart
Then heroku run rake myapp:test_exception
=>
Running rake myapp:test_exception on ⬢ myapp... up, run.2877
W, [2016-06-27T12:23:56.017117 #3]
WARN -- : ** [Bugsnag] No API key configured, couldn't notify rake aborted!
This is a sample exception
/app/lib/tasks/test_exception.rake:9:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.2.0/gems/bugsnag-4.2.1/lib/bugsnag/rake.rb:12:in `execute_with_bugsnag'
Tasks: TOP => jd:sample_exception
(See full trace by running task with --trace)
I want heroku to send exception to bugsnag. What did I miss?
Note: The bugsnag integration works fine (I see the exception in the bugsnag UI) if I run the command locally, eg: rake myapp:test_exception