-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Using guard to run integration tests results in undefined method `set_transaction_name' for nil:NilClass #1885
Comments
@sl0thentr0py I think you're right. I added a
Any idea on what my be causing the premature |
@markedmondson so it's only with guard? I don't know how guard works, I'd need to read their source. Can you maybe give me a minimal repro with rails + guard or a bunch of precise steps to follow? |
Yeah, with guard. I'll see what I can do. I would imagine Spring may suffer a similar problem and if not, it could provide a solution. |
Here is a minimal repository with a reproduction of the issue with rails, guard, sentry: https://github.com/adamcooper/sentry_guard_bug There are steps in the readme on how to reproduce the issue. Let me know if you have questions. You'll notice that running |
@adamcooper Thank you very much for the repo. I think this issue is because
If we remove the unnecessary part, we can get a repro command like:
But if we exclude the
And I think if you use It's still not clear how SolutionWhen defining the |
@st0012 great investigation! I believe we just need better |
Issue Description
When I run my rails controller tests using guard I get an error ever since upgrading from 5.3.1 to 5.4.2.
The errors seems to be because
Sentry.get_current_scope
is returningnil
and the code expects it to always return a scope.I'm able to stop the error from happening by handling the
nil
:But, this code hasn't changed in 2 years so I'm assuming something else was changed in 5.4.0 that is causing
Sentry.get_current_scope
to returnnil
. I've confirmed thatSentry.init
is being called before these tests are run so my guess is that something is causing the Thread to disconnect or fail silently between test runs.Reproduction Steps
Haven't had a chance to test these steps on a plain rails 7 app yet:
Expected Behavior
Tests run successfully
Actual Behavior
Tests fail with the following error:
Ruby Version
ruby 3.0.4p208
SDK Version
5.4.2
Integration and Its Version
Rails 7
Sentry Config
No response
The text was updated successfully, but these errors were encountered: