redis-store: Error "unknown keyword: :raw" raised with Redis gem 5.x

Probably caused by https://github.com/redis-store/redis-store/blob/v1.9.2/lib/redis/store/factory.rb#L52

image

Update 1: My input options:

DEFAULT_PORT = 6379

namespace = "#{Rails.application.class.module_parent_name.underscore}:#{Rails.env.to_s.underscore}:sessions"
uri = URI.parse(Rails.configuration.redis_url)
# Rails.configuration.redis_url in development = redis://127.0.0.1:6379/0

Rails.application.config.session_store(
  :redis_store,
  redis_server: {
    host: uri.host,
    port: uri.port || DEFAULT_PORT,
    password: uri.password,
  },
  # The `key` is the cookie key name
  # The value sometimes need to be changed when rails upgraded
  # Since some values stored are classes in old rails which no longer exists
  #
  # Changing this will force all website users to be signed out
  # So only change this when necessary
  key: "_#{Rails.application.class.module_parent_name.underscore}_#{Rails.env.to_s.underscore}_sessions_#{:v2017_01_04_1426}_",
)

Update 2: Tested with modified code https://github.com/PikachuEXE/redis-store/commit/50fec7055461357c4b1ddb467deb245d2d8cca0b to confirm that the error is caused by raw option set in this gem Tested with development (URL mentioned above) and staging (URL like redis://default:password@10.10.10.10:6379)

Update 3: raw (in factory) introduced by https://github.com/redis-store/redis-store/pull/265

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 23

Most upvoted comments

It seems scheme option is also unknown:

ApplicationIntegrationTest#test_children_of_ApplicationController_do_not_raise_when_a_valid_CSRF_token_is_provided:
ArgumentError: unknown keyword: :scheme
    /home/spin/.bundle/pricing/gems/redis-client-0.12.2/lib/redis_client/config.rb:21:in `initialize'
    /home/spin/.bundle/pricing/gems/redis-client-0.12.2/lib/redis_client/config.rb:182:in `initialize'
    /home/spin/.bundle/pricing/gems/shopify_metrics-1.16.0/lib/shopify_metrics/client_adapters/redis_client_adapter.rb:104:in `initialize'
    /home/spin/.bundle/pricing/gems/redis-client-0.12.2/lib/redis_client.rb:143:in `new'
    /home/spin/.bundle/pricing/gems/redis-client-0.12.2/lib/redis_client.rb:143:in `config'
    /home/spin/.bundle/pricing/gems/redis-5.0.6/lib/redis/client.rb:23:in `config'
    /home/spin/.bundle/pricing/gems/redis-5.0.6/lib/redis.rb:157:in `initialize_client'
    /home/spin/.bundle/pricing/gems/redis-5.0.6/lib/redis.rb:73:in `initialize'
    /home/spin/.bundle/pricing/gems/redis-store-1.9.2/lib/redis/store.rb:17:in `initialize'

i use the following patch to bypass the issue

class RedisClient::Config
  alias original_initialize initialize

  def initialize(**kwargs)
    # remove not supported kwargs
    original_initialize(
      **kwargs.except(:raw, :serializer, :marshalling, :namespace, :scheme)
    )
  end
end

Any update on this? I just ran into this going through a ruby 3 upgrade since 2 EOL’d

Closing this since https://github.com/redis-store/redis-store/pull/359 merged You can point to github (and specific commit to be sure) and see if it fixes your issue Reopen only if more related problem found

1.9.1 cannot be used with redis 5.x - https://github.com/redis-store/redis-store/blob/v1.9.1/redis-store.gemspec Which is the whole point of this issue

I am getting this error when I performed a bundle update on redis-rails which upgraded redis-store to 1.9.2:

ArgumentError: unknown keywords: :scheme, :namespace, :expires_in, :raw

Locking to gem 'redis-store', '1.9.1' for now get me past this issue.

We get scheme and namespace mentioned as unknown keywords:

<ArgumentError: unknown keywords: :scheme, :namespace> at
 /gems/redis-client-0.12.2/lib/redis_client/config.rb:21:in `initialize'
 /gems/redis-client-0.12.2/lib/redis_client/config.rb:182:in `initialize'
 /gems/redis-client-0.12.2/lib/redis_client.rb:143:in `new'
 /gems/redis-client-0.12.2/lib/redis_client.rb:143:in `config'
 /gems/redis-5.0.6/lib/redis/client.rb:23:in `config'
 /gems/redis-5.0.6/lib/redis.rb:157:in `initialize_client'
 /gems/redis-5.0.6/lib/redis.rb:73:in `initialize'
 /gems/redis-store-1.9.2/lib/redis/store.rb:17:in `initialize'