crypt_keeper: Delayed job: ActiveSupport::MessageEncryptor::InvalidMessage

Hey folks, I’ve got a crypt_keepered model that is called in a delayed_job. It runs fine in development with perform_now and perform_later. On Heroku however, it fails with just perform_later

I thought it might be an issue with getting the key/salt from the ENV. So I tried ENV[“KEY”], ENV.fetch(“KEY”) and also by using Rails secrets but I’m not sure this is the problem.

Any ideas what might be causing this?

Thanks! Rikki

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Hi @vishaldeepak, good question! I think I probably ended up just using the built in Rails encryption if I remember correctly!

https://guides.rubyonrails.org/active_record_encryption.html

I just created a really basic job that works with perform_now but not perform_later on Heroku:

# frozen_string_literal: true

class TestJob < ApplicationJob
  queue_as :default

  def perform(company_id)
    company = Company.find(company_id)

    puts company.uid
  end
end