Skip to content

sentry-ruby raises exceptions when Rails/Rake processes run in Rails 6.1.0 #1145

@geoffharcourt

Description

@geoffharcourt

Describe the bug

Our application is currently running Rails 6.0.3.4 and sentry-ruby 4.0.1. When we try to update to Rails 6.1.0, almost all of our processes fail to start with what looks like a Sentry error:

rake aborted!
NoMethodError: undefined method `current_client' for nil:NilClass.

If we remove sentry-ruby the application and test processes (mostly started by rake) are able to start. The backtrace is longer with sentry-ruby 4.0.1 than 4.0.0, but it's the same exception. We're unable to run rake, or rspec.

To Reproduce

  1. Generate a Rails 6.1 app with rails new proof_of_concept
  2. Add gem "sentry-ruby", "4.0.1" to the Gemfile and run bundle install
  3. Run any Rake command such as bundle exec rake routes or bundle exec rake notes`

Expected behavior

Rake tasks should be able to execute.

Actual behavior

An exception is raised.

Environment

  • Ruby Version: 2.6.6
  • SDK Version: 4.0.1
  • Integration Versions (if any): sentry-rails 4.0.0, sentry-sidekiq 4.0.0. We are able to produce these exceptions without the integrations so we do not believe they are the cause

Raven Config

These exceptions occur with no further configuration, but here's our application's Sentry initializer:

Sentry.init do |config|
  config.dsn = ENV["RAVEN_DSN"]
  config.excluded_exceptions += [
    "ActionController::RoutingError",
    "ActionController::UnknownHttpMethod",
    "Mime::Type::InvalidMimeType",
    "Puma::HttpParserError",
    "Sidekiq::Limiter::OverLimit",
    "Rack::QueryParser::InvalidParameterError",
  ]

  if ENV["SENTRY_ENVIRONMENT"] == "staging"
    config.excluded_exceptions += ["PG::ConnectionBad", "PG::Error"]
  end

  config.environment = ENV["SENTRY_ENVIRONMENT"] ||
    ENV["HEROKU_APP_NAME"] ||
    ENV["RAILS_ENV"]
end

Metadata

Metadata

Assignees

Labels

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions