Skip to content

Capture rails runner's exceptions #1789

@manuelmeurer

Description

@manuelmeurer

Issue Description

When I run bin/rails runner "raise 'test error'", it is not sent to Sentry. (same with bundle exec rails runner).
I was under the impression that this was fixed in #1448.

bin/rails runner "Sentry.capture_message 'text'" and bin/rails runner "Sentry.capture_exception StandardError.new('text')" both work as expected.
bin/rails runner "puts Sentry.configuration.background_worker_threads" prints 0, also as expected.
What am I doing wrong?

Reproduction Steps

Run bin/rails runner "raise 'test error'"

Expected Behavior

An error reported to Sentry

Actual Behavior

No error is reported to Sentry

Ruby Version

3.1.1

SDK Version

5.2.1

Integration and Its Version

Rails 5.2.1, Sidekiq 5.2.1

Sentry Config

Sentry.init do |config|
  config.breadcrumbs_logger             = %i(active_support_logger http_logger)
  config.traces_sample_rate             = 0.2
  config.capture_exception_frame_locals = true
  config.release                        = Rails.configuration.revision
  config.send_default_pii               = true
end

Metadata

Metadata

Assignees

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