-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NameError uninitialized constant MyWorker #3779
Comments
The advice from this blog post in 2014 has solved this kind of problem for me. |
@mikegee I am happy my blog post was helpful to you. just remember that what you were trying to do was probably unnecessary https://blog.arkency.com/2014/11/dont-forget-about-eager-load-when-extending-autoload/#one_more_thing and if you have |
Thanks @paneq! I’ve used your advice to add |
Solution is not working for me, my |
@AshvinChauhan what is the full path to the file ( |
full path is and my)worker.rb containing following
|
@mperham can you please reopen the issue, because my issue is not resolved yet. |
You’ll need to give us a Rails app that reproduces the problem. This issue is not a Sidekiq bug.
… On Mar 5, 2018, at 20:39, AshvinChauhan ***@***.***> wrote:
@mperham can you please reopen the issue, because my issue is not resolved yet.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Issue is only in rails 5, its working proper in older version of rails. |
Any update? |
Still waiting on your app to reproduce the problem.
… On Mar 8, 2018, at 20:13, AshvinChauhan ***@***.***> wrote:
Any update?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Okay will provide you soon |
In rails 5 production mode got same issue. |
In rails 5, same problem here in development with a simple mailer in app/mailers. Sometimes email is sent, sometimes after one or various retries. Always the same error "uninitialized constant ContactMailer" but randomly occurs. Sidekiq 5.2.5, redis 4.1.0, rails 5.2.2, ruby 2.5.3. Never had this problem before. |
I am having exact same issue, Sending text messages using it , the order of the gets messed up because of the uninitialized constant error. Sidekiq 5.2.6, Rails 5.1.6, Ruby 2.5.3, Redis 4.0. Works after one or couple retries. ### UPDATE: I figured out the issue, i was using same redis server for multiple instances of the app causing sidekiq confusion of where to look in redis. this helped me which suggests to use namespace in case same redis db is used. |
Oh Man this was really hard to figure out for me, it has nothing to do with the eager_load or autoload paths. If you are using puma with many workers then you need to call these below the workers number in your config/puma.rb
|
In my case, I just restarted Sidekiq on production and it fixed a problem: |
Restarting the sidekiq service worked for me as well |
I solved too! |
Rails version: 5.1.4
Ruby version: 2.5.0
Sidekiq / Pro / Enterprise version(s): 5.1.0
sidekiq.yml
sidekiq.rb
Error
NameError uninitialized constant MyWorker
Every time I am getting this error, and after some retries its working fine. and in development everything is working fine, but in production its not.
I also try to add it in
application.rb
as followingconfig.autoload_paths += Dir[Rails.root.join('app', 'workers')]
The text was updated successfully, but these errors were encountered: