Heroku / Sidekiq does not find after_commit database record

Here is my code:

after_commit :notify, on: :create

The method notifycalls ServiceRequestMailerWorker.perform_async(self.id, email), and here is my mail as follows:

class ServiceRequestMailerWorker
  include Sidekiq::Worker

  def perform(service_request_id, send_to)
    @service_request = ServiceRequest.find(service_request_id)
    @customer = @service_request.customer
    WarrantyMailer.submitted(@service_request, @customer, send_to).deliver
  end
end

Error:

2014-07-22T03:05:25.626004+00:00 app[worker.1]: 2014-07-22T03:05:25.625Z 2 TID-os0kqm6sg DEBUG: enqueued retry: {"retry":true,"queue":"default","class":"ServiceRequestMailerWorker","args":[787,"email@email.com"],"jid":"f1d8f416718bafa8c809fa3e","enqueued_at":1405998308.4219391,"error_message":"Couldn't find ServiceRequest with 'id'=787 [WHERE (company_id IS NOT NULL)]","error_class":"ActiveRecord::RecordNotFound","failed_at":1405998308.618538,"retry_count":0}

This ONLY happens in my staging environment on Heroku. I tried to debug this for hours. Anyone else run into this issue?

+4
source share

All Articles