Search code examples
ruby-on-railsruby-on-rails-5sidekiq

`uninitialized constant Sidekiq::Rails::Reloader` after upgrading to Rails 5.0.0.1


I just upgraded from Rails 4.2.6 to Rails 5.0.0.1. I have the following configuration for Sidekiq UI in config/routes.rb:

if Rails.application.queuing_enabled?
  require 'sidekiq/web'
  Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]

  authenticate :user, ->(u) { u.admin? } do
    mount Sidekiq::Web => '/sidekiq'
  end
end

The value of Rails.application.queuing_enabled? will always be true in production mode, but false in development and test.

After upgrading, I am facing the below error when I run anything on my local (tried running rspec, rails middleware etc.):

rails aborted!
NameError: uninitialized constant Sidekiq::Rails::Reloader
/home/project/config/routes.rb:66:in `block in <top (required)>'
/home/project/config/routes.rb:2:in `<top (required)>'
/home/project/config/environment.rb:6:in `<top (required)>'
/home/project/bin/rails:9:in `require'
/home/project/bin/rails:9:in `<top (required)>'
/home/project/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => middleware => environment
(See full trace by running task with --trace)

My Gemfile.lock has the following versioning info for Sidekiq.

sidekiq (4.2.7)
  concurrent-ruby (~> 1.0)
  connection_pool (~> 2.2, >= 2.2.0)
  rack-protection (>= 1.5.0)
  redis (~> 3.2, >= 3.2.1)
sidekiq-limit_fetch (3.4.0)
  sidekiq (>= 4)

Any help is greatly appreciated. Thanks!


Solution

  • Apparently, this was a bug with Sidekiq 4.2.7, which will be resolved in the next release.

    Please see https://github.com/mperham/sidekiq/issues/3275 for more details.