rails: redis gem 4+ incompatibility "Specified 'redis' for Action Cable pubsub adapter, but the gem is not loaded"
Steps to reproduce
Using ActionCable 5.1.3 with the redis
gem upgraded from 3.3.3 to 4.0.0 and attempting to broadcast on a channel seems to yield this exception:
Specified 'redis' for Action Cable pubsub adapter, but the gem is not loaded. Add `gem 'redis'` to your Gemfile (and ensure its version is at the minimum required by Action Cable).
Going back to ~> 3.3 makes AC work again as expected.
Expected behavior
AC should work
Actual behavior
An exception is raised indicating the gem is not loaded, but it seems to be.
Going back to ~> 3.3 makes AC work again as expected.
System configuration
Rails version: 5.1.3
Ruby version: 2.4.1
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 29
- Comments: 17 (5 by maintainers)
Commits related to this issue
- Lock to older redis version I was getting the exception documented here: https://github.com/rails/rails/issues/30527 Looks fixed but not yet deployed so I'm retreating to the older version of the r... — committed to jonallured/bearden by jonallured 7 years ago
- Lock to older redis version I was getting the exception documented here: https://github.com/rails/rails/issues/30527 Looks fixed but not yet deployed so I'm retreating to the older version of the r... — committed to jonallured/bearden by jonallured 7 years ago
- Force Redis version (https://github.com/rails/rails/issues/30527) — committed to jbox-web/deploy-it by deleted user 7 years ago
- [B] Downgrade redis and redis-objects Action cable is not compatibile with v4 of the redis gem. See rails/rails#30527 — committed to ManifoldScholar/manifold by zdavis 6 years ago
Can confirm that this happened to me as well.
Rails Version 5.0.0.1. Ruby Version 2.2.3
I tried running Redis 4.0 and received the error.
When I moved back to ~> 3.3 then everything was fine and web sockets worked.
Im experiencing the same problem! with Redis 4.0.1, I had to downgrade to 3.3.5
I had the same issue. I solved it by updating my gems (
bundle update
). Not sure which gem exactly solved it. Now I have:ruby 2.5.0
,rails 5.1.5
,redis 4.0.1
,actioncable 5.1.5
. Perhaps this method is not suitable for everyone, but it worked for me.I didn’t backport https://github.com/rails/rails/commit/37895311514a35333e5597018852eb0fe2c9eb28 to 5-0-stable because the build wasn’t failing with the error that 5-1-stable was failing with.
5.0 is only supported for security fixes now so we’re likely not going to backport this to 5.0. Our recommendation is to upgrade to 5.1.
I had the same problem - @Xosmond temporary(?) solution worked for me as well.
seems like it doesn’t backport to rails 5.0.7 (ruby 2.4.4) still having the same problem with redis 4 cc @eileencodes
any updates? I faced same issue on heroku.
versions: ruby-2.4.0 rails: ‘~> 5.1.3’
but when I try to downgrade redis to 3.3.3, heroku reject my commit.
how can i fix it?
I can also confirm that this issue persists in 5.1.4. As @rikkipitt discovered, the version constraint for the
redis
gem that actioncable is requesting is too strict:https://github.com/rails/rails/blob/813af4655f9bf3c712cf50205eebd337070cee52/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb#L4
https://github.com/rails/rails/blob/813af4655f9bf3c712cf50205eebd337070cee52/actioncable/lib/action_cable/subscription_adapter/redis.rb#L3
Which causes this exception to be raised when using a 4.x version of the redis gem (4.0.0 was released August 25):
https://github.com/rails/rails/blob/813af4655f9bf3c712cf50205eebd337070cee52/actioncable/lib/action_cable/server/configuration.rb#L30
It would also be helpful for debugging if the exception being raised mentioned the specific constraint that wasn’t satisfied (which should be present in the exception being caught) instead of saying the minimum required version wasn’t met.
I can start a PR, but some more testing may be required before the version constraint can be relaxed since this is a major version bump @maclover7 @matthewd