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
Doesn't work with spring #26
Comments
TylerRick
added a commit
to TylerRick/exception_notification-rake
that referenced
this issue
May 21, 2019
…essage This is based on how https://github.com/airbrake/airbrake/blob/master/lib/airbrake/rake.rb does it Fixes nikhaldi#26
TylerRick
added a commit
to TylerRick/exception_notification-rake
that referenced
this issue
May 22, 2019
…essage This is based on how https://github.com/airbrake/airbrake/blob/master/lib/airbrake/rake.rb does it Fixes nikhaldi#26
TylerRick
added a commit
to TylerRick/exception_notification-rake
that referenced
this issue
Jun 20, 2023
…essage This is based on how https://github.com/airbrake/airbrake/blob/master/lib/airbrake/rake.rb does it Fixes nikhaldi#26
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
Check out a Rails app that has spring inserted in the binstubs — for example, this example app:
https://github.com/TylerRick/exception_notification-rake_example_with_spring/tree/workaround_using_load_in_bin_rake
Run
bin/rake check:exception
Observe that no email is sent
How it's supposed to work
Normally (without spring), what happens is:
bin/rake
binstub gets loaded first, andrake.rb
andrake/rake_module.rb
(which definesRake.application
) to get loaded.Bundler.require
loadsexception_notification-rake
gem, which checks thatRake.application
is defined and patchesRake::Application#display_error_message
This is evident from the following backtraces taken at those 2 points:
(or if using global
rake
instead ofbin/rake
binstub:)
How it works instead when using spring
But when using spring:
preload
loadsexception_notifier-rake
gem beforebin/rake
is loadedexception_notification-rake
checks ifRake.application
is defined; since it is not, it doesn't patchRake::Application#display_error_message
and so this gem has no effectbin/rake
binstub gets loaded,rake.rb
andrake/rake_module.rb
(which definesRake.application
) to get loaded (too late).Again, you can see this from the backtraces if you wish:
Workaround
One workaround is to add this line to
bin/rake
:But a better solution is needed that doesn't require modifying the binstubs that spring automatically generated...
The text was updated successfully, but these errors were encountered: