Skip to content

(Active-)Job errors not send (sentry-resque) #1754

@Flixt

Description

@Flixt

Issue Description

Errors that happen within Jobs are not sent to Sentry when using sentry-rails and sentry-resque

The problem was encountered after upgrading our app to Rails 7 and Ruby 3.0.2

We upgraded:

sentry-ruby from '~> 4.6.5', to '~> 5.1.1'
sentry-rails from '~> 4.6.5', to '~> 5.1.1'

And we switched from our own fork of resque-sentry to sentry-resque', '~> 5.1.1'
We noticed after a while, errors from whithin our jobs are no longer reported to Sentry.

I tried to hunt down the bug and here is what I found so far. Some facts beforehand:

Reproduction Steps

I forked the repository and changed the Rails 7.0 example app of sentry-rails in a way to make it possible to reproduce the issue described above.
The diff of the fork can be found here (I did not open a PR as this does not contain a fix):

master...flowdgmbh:no-resque-events-example

  • Clone the fork
  • cd sentry-ruby/sentry-rails/examples/rails-7.0
  • bundle install
  • Change the dsn in sentry-rails/examples/rails-7.0/config/initializers/sentry.rb
  • RAILS_ENV=development COUNT=1 QUEUE=* bundle exec rake resque:workers
  • In another terminal schedule a job with bundle exec rails runner 'ErrorJob.perform_later'

Expected Behavior

The error is reported to sentry

Actual Behavior

The following happens for us when an error occours in the job (in the context of the separate Reqsue worker):

Result: No error was sent to Sentry

Ruby Version

3.1.0

SDK Version

5.1.1

Integration and Its Version

No response

Sentry Config

No response

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