-
-
Notifications
You must be signed in to change notification settings - Fork 522
Description
Raven.inject checks if a number of other constants are defined before requiring the integation files. While this is necessary, it adds an implicit dependency on the order of gems in your Gemfile.
I discovered we weren't logging exceptions from Delayed::Job failures, and tracked it down to the fact that we're requiring sentry-raven in our Gemfile before delayed_job. As a result, Delayed::Plugin isn't defined by the time Raven.inject is called.
I'm not sure what the best thing to do about this is, maybe just document this requirement.
As a workaround, I copied the require into my Rails initializer for Raven:
# config/initializers/raven.rb
Raven.configure do |config|
...
end
require 'raven/integrations/delayed_job' if defined?(::Delayed::Plugin)
All the gems will have been loaded by the time Rails starts running initializers, so that workaround does the trick, regardless of the order of gems in your Gemfile.
I'd be in favour of not implicitly injecting requires, and documenting that you need to do so in your initializer, but that would be a breaking change.
Anyway, food for thought, and just thought I'd document this here in case anyone else has the same problem.