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 UniqueTextWorker #1043
Comments
Assuming you're using Rails, this could be related to autoload, I've seen this happen. Is your worker sitting under lib/ ? |
No, it's in app/workers and here's config:
|
Yeah mine are sitting under app/workers as well, and I have on my application.rb: config.autoload_paths += %W(#{config.root}/app/workers) 😕 |
Yeah, now it works. Thank you! |
Now I'm getting that error only with big queues - first 25 workers starting ok, all the next failing. |
Even when sidekiq is paused (bundle exec sidekiqctl quiet) - all workers fail immediately after adding to queue. |
Try using config.eager_load_paths += instead of autoload. See https://github.com/mperham/sidekiq/wiki/FAQ (Why doesn't Sidekiq autoload my Rails application code?) |
I'm already using both. |
Only other thing I can think about is there could be something else breaking and preventing your class from being loaded. I never had your second issue, it either always found out the class or never found the class. 😐 |
Try to explicitly require your worker code before the application is defined. require './app/workers/unique_text_worker'
module YourApplication
class Application < Rails::Application
# ... |
dimko, it didn't help. I've updated sidekiq from 2.14.0 to 2.14.4 - still nothing. |
Another option is to try initializing (using in any way) the class in the sidekiq initializer. That should make sure its loaded into memory before any of the workers get to using it. |
I'm having a similar issue just now... All of my mailer jobs are failing because the class can't be found: All mailers are in Rails version 3.2.14 We go live tomorrow! Any advice would help right now |
In my case I had old Sidekiq process that was not terminated and was hanging in "terminating" status for a week. Try to kill and restart all sidekiq processes. |
Hey @kshnurov thanks for the feedback. This was actually a developer error, I'd removed the |
If this is happening locally, make sure that http://guides.rubyonrails.org/v3.2.13/configuring.html#rails-general-configuration config.eager_load_paths accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. Defaults to every folder in the app directory of the application. This worked for me in development with Rails 3.2.13, Sidekiq 2.12.0. |
Sidekiq always eager loads due to thread safety. It does not support development mode and ignores cache_classes. On Aug 1, 2013, at 18:48, Christopher Chow notifications@github.com wrote:
|
I am getting NameError (uninitialized constant Api::V1::EmailController::ResponseWorker) when I try to call workers from my controller , I added autoload paths still getting this error , can anyone please help me |
@vkeziah Some information that would be helpful in getting to the bottom of your problem:
|
class ResponseWorker
Please let me know if you nee any more information |
@vkeziah : upgrade to sidekiq 3.3.x and try again. |
yep it works ... thanks However I am facing wiht another problem .. when I try to find the records from the db I am getting error stack level too deep , not sure where the error is but I am suspecting that its with db connection and thought that it was unable to establish the connection with db to find the records. Can you please let me know how to log the exact errors and way to work with database from workers. |
Please don't hijack old issues; open your own issue. Usage questions belong on the mailing list. |
I have a typical worker:
When I'm trying to run some workers (seriosly - some place_ids work, some not), I'm getting an error: "NameError: uninitialized constant UniqueTextWorker".
Code is totally fine and successfully working outside of sidekiq. Backtrace is useless. What's wrong?
The text was updated successfully, but these errors were encountered: