We've moved discussions to Discord

Heroku Redis problem: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)

David Barta
Was deploying my jumpstartpro app to heroku and everything worked.

In the last few days I'm getting this error:

2021-08-26T19:34:26.075506+00:00 app[web.1]: #<Thread:0x00005562640545d0 /app/vendor/bundle/ruby/3.0.0/gems/actioncable-6.1.4/lib/action_cable/subscription_adapter/redis.rb:150 run> terminated with exception (report_on_exception is true):

2021-08-26T19:34:26.075591+00:00 app[web.1]: /app/vendor/bundle/ruby/3.0.0/gems/redis-4.3.1/lib/redis/client.rb:382:in `rescue in establish_connection': Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) (Redis::CannotConnectError)

Searching Google seems to indicate some issue with redis 6 on heroku, which requires a configuration change in cable.yml like so:

production:
  adapter: redis
  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
  ssl_params:
    verify_mode: <%= OpenSSL::SSL::VERIFY_NONE %>

  channel_prefix: jumpstart_production

I implemented this change but it didn't help. The app keeps crashing. Any idea how to solve this?


David Barta
Since I don't need ActionCable for this app, until this is resolved I changed "redis" to "async" for production in cable.yml . Now the heroku deployment works.

Chris, you may want to consider a configuration option for jumpstartpro apps, to turn off actioncable for those that don't need it.
It's happened to me also. But I changed back Redis to async again then it works. Probable using Redis sidekiq will be better but since it's quite hard to set up especially in development & production, probably we will leave it for time being.

Notifications
You’re not receiving notifications from this thread.