Skip to content

Uninitialized constant when using ActiveSupport::ParameterFilter #12082

@jmatsuba

Description

@jmatsuba

Issue Description

During a ruby upgrade we have noticed that ActiveSupport::ParameterFilter started coming up as uninitialized during our deployment process. It is reproducible in the test environment on a fresh install of rails app and sentry-ruby and sentry-rails gems. It is a bit weird that the development environment has no issues starting up. We are experiencing this issue in a deployed environment and when running tests locally.

Exception:
/config/initializers/sentry.rb:4:in block in <main>: uninitialized constant ActiveSupport::ParameterFilter (NameError)

Reproduction Steps

  1. fresh rails install (ruby 3.3.4 & rails 7.2)
  2. add gems of sentry-ruby & sentry-rails, and bundle install
  3. add a initializer for sentry
  4. add a ActiveSupport::ParameterFilter (as described in https://docs.sentry.io/platforms/ruby/guides/rails/configuration/filtering/)
  5. rails test

Expected Behavior

rails test to start without exceptions

or

Documentation to be updated with require "active_support/parameter_filter" as part of the required initializer code.

Actual Behavior

Exception:
/config/initializers/sentry.rb:4:in block in <main>: uninitialized constant ActiveSupport::ParameterFilter (NameError)

Ruby Version

3.3.4

SDK Version

sentry-ruby (5.19.0), sentry-rails (5.19.0)

Integration and Its Version

Rails

Sentry Config

Sentry.init do |config|
  config.dsn = 'redacted'

  filter = ActiveSupport::ParameterFilter.new(Rails.application.config.filter_parameters)

  config.before_send = lambda do |event, hint|
    filter.filter(event.to_hash)
  end

  # get breadcrumbs from logs
  config.breadcrumbs_logger = [:active_support_logger, :http_logger]

  # enable tracing
  # we recommend adjusting this value in production
  config.traces_sample_rate = 1.0

  # enable profiling
  # this is relative to traces_sample_rate
  config.profiles_sample_rate = 1.0
end

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions