Skip to content

undefined method `exclude_loggers' for nil:NilClass during Rails boot on production #1858

@tvdeyen

Description

@tvdeyen

Issue Description

Booting a Rails app during deployment fails with

undefined method `exclude_loggers' for nil:NilClass (NoMethodError)

in

/opt/render/project/.gems/ruby/2.7.0/gems/sentry-ruby-5.4.1/lib/sentry/breadcrumb/sentry_logger.rb:80:in `ignored_logger?': undefined method `exclude_loggers' for nil:NilClass (NoMethodError)
  from /opt/render/project/.gems/ruby/2.7.0/gems/sentry-ruby-5.4.1/lib/sentry/breadcrumb/sentry_logger.rb:55:in `add_breadcrumb'
  from /opt/render/project/.gems/ruby/2.7.0/gems/sentry-ruby-5.4.1/lib/sentry/breadcrumb/sentry_logger.rb:18:in `add'
  from /opt/render/project/rubies/ruby-2.7.6/lib/ruby/2.7.0/logger.rb:494:in `debug'
  from /opt/render/project/.gems/ruby/2.7.0/gems/newrelic_rpm-8.9.0/lib/new_relic/agent/agent_logger.rb:94:in `block in format_and_send'
  from /opt/render/project/.gems/ruby/2.7.0/gems/newrelic_rpm-8.9.0/lib/new_relic/agent/agent_logger.rb:91:in `each'
  from /opt/render/project/.gems/ruby/2.7.0/gems/newrelic_rpm-8.9.0/lib/new_relic/agent/agent_logger.rb:91:in `format_and_send'
  from /opt/render/project/.gems/ruby/2.7.0/gems/newrelic_rpm-8.9.0/lib/new_relic/agent/agent_logger.rb:44:in `debug'
  from /opt/render/project/.gems/ruby/2.7.0/gems/newrelic_rpm-8.9.0/lib/new_relic/agent/threading/agent_thread.rb:20:in `block in create'

Reproduction Steps

  1. Update to sentry-ruby 5.4.1
  2. Deploy to production
  3. Run rake db:migrate

Expected Behavior

It should not fail

Actual Behavior

It should work

Ruby Version

2.7.6

SDK Version

5.4.1

Integration and Its Version

Rails 6.0.5.1

Sentry Config

Sentry.init do |config|
  config.release = "<snip>"
  config.dsn = ENV["SENTRY_DSN"]
  config.breadcrumbs_logger = [:sentry_logger, :active_support_logger, :http_logger]
end

Metadata

Metadata

Assignees

Labels

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions