Skip to content

Instantly share code, notes, and snippets.

@cupnoodle
Last active April 30, 2020 14:34
Show Gist options
  • Save cupnoodle/11a20ae118426b511412241ebabb4e1f to your computer and use it in GitHub Desktop.
Save cupnoodle/11a20ae118426b511412241ebabb4e1f to your computer and use it in GitHub Desktop.
Solving Name Error Uninitialized constant for Sidekiq job

Solving Name Error Uninitialized constant for Sidekiq job

This guide is for you if you have attempted steps below but still has issue :

  1. Double checked the file name and folder structure, and it did follow Rails convention
  2. Added auto load and eager load path
  3. All previous jobs ran successfully, but only this new job you added has this uninitialized constant
  4. This issue only happens in your production / staging server , but it worked fine in your local development machine
  5. Sometimes the job executed successfully, sometimes you get the uninitialized constant error

Chances are, your server might have two or more Sidekiq process running, and the old sidekiq process has no information on this new job.

You might have just recently upgraded Sidekiq version, and forgot to kill the old sidekiq process.

SSH into your server, type ps aux | grep sidekiq If you saw more than one sidekiq process, then bingo! The solution is to kill the old sidekiq process, kill 1234 , replace 1234 with your old sidekiq process pid.

Thanks @anonoz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment