Skip to content

Undefined method 'close' when using config.backlog = false #730

@williantenfen

Description

@williantenfen
  • Airbrake version: airbrake (13.0.4) - airbrake-ruby (6.2.2)
  • Ruby version: 3.1.6
  • Framework name & version: Rails 7.0.8.6
#### Airbrake config

   Airbrake.configure do |c|
  # You must set both project_id & project_key. To find your project_id and
  # project_key navigate to your project's General Settings and copy the values
  # from the right sidebar.
  # https://github.com/airbrake/airbrake-ruby#project_id--project_key
  c.project_id = ENV.fetch("AIRBRAKE_APP_ID", nil)
  c.project_key = ENV.fetch("AIRBRAKE_KEY", nil)

  # Configures the root directory of your project. Expects a String or a
  # Pathname, which represents the path to your project. Providing this option
  # helps us to filter out repetitive data from backtrace frames and link to
  # GitHub files from our dashboard.
  # https://github.com/airbrake/airbrake-ruby#root_directory
  c.root_directory = Rails.root

  # By default, Airbrake Ruby outputs to STDOUT. In Rails apps it makes sense to
  # use the Rails' logger.
  # https://github.com/airbrake/airbrake-ruby#logger
  c.logger = Airbrake::Rails.logger

  # Configures the environment the application is running in. Helps the Airbrake
  # dashboard to distinguish between exceptions occurring in different
  # environments.
  # NOTE: This option must be set in order to make the 'ignore_environments'
  # option work.
  # https://github.com/airbrake/airbrake-ruby#environment
  c.environment = Rails.env

  # Setting this option allows Airbrake to filter exceptions occurring in
  # unwanted environments such as :test.
  # NOTE: This option *does not* work if you don't set the 'environment' option.
  # https://github.com/airbrake/airbrake-ruby#ignore_environments
  c.ignore_environments = %w(test development)

  # A list of parameters that should be filtered out of what is sent to
  # Airbrake. By default, all "password" attributes will have their contents
  # replaced.
  # https://github.com/airbrake/airbrake-ruby#blocklist_keys
  c.blocklist_keys = [/password/i, /authorization/i]

  # Alternatively, you can integrate with Rails' filter_parameters.
  # Read more: https://goo.gl/gqQ1xS
  # c.blocklist_keys = Rails.application.config.filter_parameters

  c.performance_stats = !Rails.env.test?

  c.remote_config = !Rails.env.test?
  c.backlog = false
end

Description

When using config.backlog = false , performance_notifier tries to call .close from empty @backlog instance:

airbrake-ruby-6.2.2/lib/airbrake-ruby/sync_sender.rb:69:in `close': undefined method `close' for nil:NilClass (NoMethodError)
      @backlog.close
              ^^^^^^
  from /Users/.../.asdf/installs/ruby/3.1.6/lib/ruby/gems/3.1.0/gems/airbrake-ruby-6.2.2/lib/airbrake-ruby/performance_notifier.rb:53:in `block in close'
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions