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

NoMethodError: undefined method add_session' for nil #2268

Closed
kamilpogo opened this issue Mar 13, 2024 · 4 comments
Closed

NoMethodError: undefined method add_session' for nil #2268

kamilpogo opened this issue Mar 13, 2024 · 4 comments
Assignees

Comments

@kamilpogo
Copy link

Issue Description

After updating from sentry-ruby & sentry-rails 5.16.1 to 5.17 my system tests are failing with NoMethodError: undefined method add_session' for nil`

Rails 7.1.3.2
minitest 5.22.3
puma 6.4.2

Reproduction Steps

run system test using minitest

Expected Behavior

test run successfully (like with previous version)

Actual Behavior

test fail with

NoMethodError: undefined method `add_session' for nil
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/sentry-ruby-5.17.0/lib/sentry/hub.rb:244:in `end_session'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/sentry-ruby-5.17.0/lib/sentry/hub.rb:253:in `with_session_tracking'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/sentry-ruby-5.17.0/lib/sentry-ruby.rb:403:in `with_session_tracking'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/sentry-ruby-5.17.0/lib/sentry/rack/capture_exceptions.rb:19:in `block in call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/sentry-ruby-5.17.0/lib/sentry/hub.rb:59:in `with_scope'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/sentry-ruby-5.17.0/lib/sentry-ruby.rb:383:in `with_scope'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/sentry-ruby-5.17.0/lib/sentry/rack/capture_exceptions.rb:18:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.1.3.2/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/rack/logger.rb:37:in `call_app'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/rack/logger.rb:24:in `block in call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/tagged_logging.rb:135:in `block in tagged'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/tagged_logging.rb:39:in `tagged'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/tagged_logging.rb:135:in `tagged'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/broadcast_logger.rb:240:in `method_missing'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/rack/logger.rb:24:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ahoy_matey-5.0.2/lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.1.3.2/lib/action_dispatch/middleware/remote_ip.rb:92:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.1.3.2/lib/action_dispatch/middleware/request_id.rb:28:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.0.9.1/lib/rack/method_override.rb:28:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.0.9.1/lib/rack/runtime.rb:24:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.1.3.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-7.1.3.2/lib/action_dispatch/middleware/static.rb:25:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.0.9.1/lib/rack/sendfile.rb:114:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.3.2/lib/rails/engine.rb:536:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.0.9.1/lib/rack/urlmap.rb:76:in `block in call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.0.9.1/lib/rack/urlmap.rb:60:in `each'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.0.9.1/lib/rack/urlmap.rb:60:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.0.9.1/lib/rack/builder.rb:264:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/capybara-3.40.0/lib/capybara/server/middleware.rb:60:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/configuration.rb:272:in `call'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/request.rb:100:in `block in handle_request'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/request.rb:99:in `handle_request'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/server.rb:464:in `process_client'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/server.rb:245:in `block in run'
    /home/kamil/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.2/lib/puma/thread_pool.rb:155:in `block in spawn_thread'

Ruby Version

3.3

SDK Version

5.17

Integration and Its Version

Rails: 7.1.3.2

Sentry Config

No response

@ixti
Copy link

ixti commented Mar 13, 2024

Same here after upgrading from 5.16.1 to 5.17.0 on Rails 7.0 with RSpec

@william-stacken
Copy link

I found the cause, this line should be session_tracking?, not auto_session_tracking

return yield unless configuration.auto_session_tracking

@benoittgt
Copy link

Probably fixed by #2269

@st0012
Copy link
Collaborator

st0012 commented Mar 14, 2024

Sorry for the trouble! Should be fixed after #2269 is merged.

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

No branches or pull requests

6 participants