I have a very simple Rails 7.1.3.4 app that is essentially a dashboard, where it uses Turbo Streams to display model attributes in real-time. When I deploy my app to Heroku, everything works as expected. But on localhost, my view does not update when there's a change to the model.
The best I can tell, there's some Redis config issue. I've updated config/cable.yml
to have
development: adapter: redis url: redis://localhost:6379/1
I've added a Redis initializer that sets up REDIS = Redis.new(url: "redis://localhost:6379/1")
In a rails console, REDIS.ping
returns PONG
.
When I update a model's attribute using update_attribute
, an Enqueued Turbo::Streams::BroadcastStreamJob
is logged.
And when I load my view in a web browser, I see <turbo-cable-stream-source channel="Turbo::StreamsChannel"
etc in the html. There are no errors in the "Console" section of Chrome dev tools, but also no activity in "Network" when an attribute updates.
That is, until I deploy the app to Heroku, which is also using Redis. My Heroku app has Network activity and the view updates appropriately.
I've compared my production.rb
and development.rb
config environments, and nothing jumps out to me as the potential cause. I've also added
config.action_cable.allowed_request_origins = [ 'http://localhost:3000' ]config.action_cable.url = "ws://localhost:3000/cable"
to config/environments/development.rb
. What could I be missing in my local set up?