good_job: "uninitialized constant GoodJob::Execution" in development env

Trying to enqueue Rails’ job in development mode:

TestJob.perform_later

… gives:

Failed enqueuing TestJob to GoodJob(default): NameError (uninitialized constant GoodJob::Execution

      execution = GoodJob::Execution.enqueue(
                         ^^^^^^^^^^^
Did you mean?  Exception)
/.../.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/good_job-2.17.0/lib/good_job/adapter.rb:72:in `enqueue_at': uninitialized constant GoodJob::Execution (NameError)

      execution = GoodJob::Execution.enqueue(
                         ^^^^^^^^^^^
Did you mean?  Exception

To fix it I can do a require 'good_job/execution'. Looks like autoloader does not catch it?

  • Happens on GoodJob 2.17.
  • 2.16.1 works fine.
  • Production and Test env are not affected, seems like only development
  • Rails 7.0.3
  • Ruby 3.1.2

Can you reproduce it? I’ll provide more details if you need them.

About this issue

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

Most upvoted comments

Fixed it for me 👍