redis-rb/redis-client

redis-client does not correctly auth without a username

Closed this issue · 2 comments

I tried using redis-client on heroku, and ran into some issues.

Heroku uses redis URLs that do not have a username. They look like rediss://:password@host:6379

According to the redis docs the implicit username is default.

However, when I call RedisClient.config(url: 'rediss://:password@host:6379') I get the username set to password, and not default. This causes the subsequent redis auth to fail.

I assume this is because of

kwargs[:username] ||= uri.user && uri.password

I don't know the history there, but it seems like uri.user.empty? ? 'default' : uri.user might make more sense. (I'm not sure what the preferred style is there, and if it needs to be defensive for nil)


I (and future searchers) can work around this by manually specifying the URL. In my Heroku setup, I use:

RedisClient.config(url: ENV.fetch("REDIS_URL"), ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }, username: 'default' )

Thanks for the report! Fixed in 230f0d4.

Thank you for the quick fix!