You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ActiveRecordSubscriber fails to log most queries on Rails 8.0.3, everywhere except JRUBY #2785
Since upgrading to sentry-ruby 6.1, instead of query logs we mostly get these:
At a glance, this is because this line accesses type_casted_binds, but only in JRUBY does type_casted_binds return an Array.
Everywhere else (unless one is using an unusual database adapter that overloads cache_notification_info), type_casted_binds returns a lambda, and since Proc#[] is an alias for Proc#call, the attempt to access a value by index on :57 actually calls the proc with the key as the unexpected argument.
Reproduction Steps
Install sentry-rails 6.1 on a Rails 8.0.3 app on MRI (with postgres, or probably almost anything)
Attempt to run any normal query with at least one bound parameter, e.g., Account.where(email: "foo@example.com").first
Expected Behavior
Logs query
Actual Behavior
Logs its own failure to log the query
Ruby Version
3.3.2
SDK Version
sentry-rails 6.1.0 (not sure what this is asking)
Integration and Its Version
Rails 8.0.3
Sentry Config
# config/initializers/sentry.rbSentry.initdo |config|
config.dsn=ENV["SENTRY_EU_DSN"]config.breadcrumbs_logger=[:active_support_logger,:http_logger]ifENV["SENTRY_LOGGING_ENABLED"]config.enable_logs=trueconfig.enabled_patches=[:logger]config.rails.structured_logging.enabled=trueconfig.send_default_pii=trueconfig.rails.structured_logging.subscribers={action_controller: Sentry::Rails::LogSubscribers::ActionControllerSubscriber,active_record: Class.new(Sentry::Rails::LogSubscribers::ActiveRecordSubscriber)dodefsql(event)# SolidQueue database queries are too noisyreturnifevent.payload[:name]&.starts_with?("SolidQueue::")superendend}end# TODO: If/when `sentry-rails` adds solid_queue or ActiveJob support for not# reporting exceptions from retried jobs (as it does for Sidekiq and DelayedJob),# use that and stop excluding `CompletedDocument::MissingFolder`config.excluded_exceptions += ["CompletedDocument::MissingFolder"]config.traces_sample_rate=1.0config.traces_sampler=lambdado |context|
trueendconfig.profiles_sample_rate=1.0config.release=ENV.fetch("HEROKU_RELEASE_VERSION","")end
Sidebar: I noticed an additional issues in the same area of the code. This particular issue does not appear to be causing us any problems, because I think binds is rarely if ever nil, but this expression:
...doesn't do quite what you probably mean. If binds == [] all is well and everything inside if is skipped, but if binds == nil, the if will evaluate to true.
Activity
linear commentedon Nov 21, 2025
RUBY-115
midnightmonster commentedon Nov 21, 2025
Sidebar: I noticed an additional issues in the same area of the code. This particular issue does not appear to be causing us any problems, because I think
bindsis rarely if evernil, but this expression:...doesn't do quite what you probably mean. If
binds == []all is well and everything insideifis skipped, but ifbinds == nil, theifwill evaluate totrue.