Home > Software design >  Rails: Sidekiq unknown driver
Rails: Sidekiq unknown driver

Time:12-29

I have a problem using sidekiq-unique-jobs. I am trying to use this gem package. In this part it describes how to implement the middleware. But when I copy that example and install the hiredis gem, I get the following error:

sidekiq_1  | 2022-12-24T20:36:58.716Z pid=1 tid=30x INFO: Booted Rails 6.1.7 application in development environment
sidekiq_1  | 2022-12-24T20:36:58.716Z pid=1 tid=30x INFO: Running in ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux-musl]
sidekiq_1  | 2022-12-24T20:36:58.716Z pid=1 tid=30x INFO: See LICENSE and the LGPL-3.0 for licensing details.
sidekiq_1  | 2022-12-24T20:36:58.716Z pid=1 tid=30x INFO: Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org
sidekiq_1  | 2022-12-24T20:36:58.718Z pid=1 tid=30x INFO: Sidekiq 7.0.2 connecting to Redis with options {:url=>"redis://redis:6379", :driver=>:hiredis, :size=>5, :pool_name=>"default"}
sidekiq_1  | Unknown driver :hiredis, expected one of: `[:ruby]`
sidekiq_1  | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client.rb:25:in `driver'
sidekiq_1  | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client/config.rb:52:in `initialize'
sidekiq_1  | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client/config.rb:176:in `initialize'
sidekiq_1  | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client.rb:138:in `new'
sidekiq_1  | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client.rb:138:in `config'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/redis_client_adapter.rb:71:in `initialize'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/redis_connection.rb:21:in `new'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/redis_connection.rb:21:in `create'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/config.rb:132:in `new_redis_pool'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/capsule.rb:77:in `local_redis_pool'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/capsule.rb:71:in `redis_pool'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/cli.rb:94:in `block in run'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/cli.rb:93:in `each_pair'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/cli.rb:93:in `run'
sidekiq_1  | /usr/local/bundle/gems/sidekiq-7.0.2/bin/sidekiq:31:in `<top (required)>'
sidekiq_1  | /usr/local/bundle/bin/sidekiq:25:in `load'
sidekiq_1  | /usr/local/bundle/bin/sidekiq:25:in `<top (required)>'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `load'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `kernel_load'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/cli/exec.rb:23:in `run'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/cli.rb:486:in `exec'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/cli.rb:31:in `dispatch'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/cli.rb:25:in `start'
sidekiq_1  | /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/libexec/bundle:48:in `block in <top (required)>'
sidekiq_1  | /usr/local/lib/ruby/3.1.0/bundler/friendly_errors.rb:120:in `with_friendly_errors'
sidekiq_1  | /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/libexec/bundle:36:in `<top (required)>'
sidekiq_1  | /usr/local/bin/bundle:25:in `load'
sidekiq_1  | /usr/local/bin/bundle:25:in `<main>'

I have no idea what I should change for hiredis as driver, and to be honest, I can't find anything on the internet about this problem. This usually means that it is not that hard to get to work, but I am struggling with this for a couple hours now!

Can someone help me fix this?

Versions:

Redis: 5.0.5
Sidekiq: 7.0.2
Sidekiq-unique-jobs: 7.1.28
Hiredis: 0.6.3
Hiredis-client: 0.11.2

CodePudding user response:

Without access to an actual PC, just reading a bit in the sidekiq source code ("Use the source, Luke!") it looks like Sidekiq 7 introduced the redis-client gem.

Conversely, one needs the hiredis-client gem inside ones Gemfile - see https://github.com/redis-rb/redis-client#drivers

  • Related