0

I'd like to configure ActionCable to work on Heroku.

I've tried changing my cable.yml file into cable.yml.erb so I can evaluate ENV['REDISTOGO_URL'] like so:

cable.yml.erb:

development:
  adapter: async

test:
  adapter: async

production:
  adapter: redis
  url: <%= ENV["REDISTOGO_URL"] %>

But now I'm getting the following error:

2016-11-23T02:24:20.551375+00:00 app[web.1]: E, [2016-11-23T02:24:20.551320 #4] ERROR -- : There was an exception - NoMethodError(undefined method `fetch' for nil:NilClass)
2016-11-23T02:24:20.551478+00:00 app[web.1]: E, [2016-11-23T02:24:20.551408 #4] ERROR -- : /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0.1/lib/action_cable/server/configuration.rb:24:in `pubsub_adapter'
2016-11-23T02:24:20.551480+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0.1/lib/action_cable/server/base.rb:72:in `block in pubsub'
2016-11-23T02:24:20.551481+00:00 app[web.1]: /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
2016-11-23T02:24:20.551482+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0.1/lib/action_cable/server/base.rb:72:in `pubsub'

If I hard code the url it will work:

cable.yml:

development:
  adapter: async

test:
  adapter: async

production:
  adapter: redis
  url: redis://redistogo:xyz42@sculpin.redistogo.com:10903/

But I think I shouldn't commit the actual url.

Is there anyway around this?

Note: I found this chunk of code and it seems like it might help but I'm not sure.

My project is at mbigras/depot

mbigras
  • 7,664
  • 11
  • 50
  • 111

1 Answers1

1

Try renaming cable.yml.erb to cable.yml itself. On my local machine it worked for me:

development:
  adapter: redis
  url: <%= ENV["REDIS_URL"] %>
mnille
  • 1,328
  • 4
  • 16
  • 20
Jyotsna
  • 34
  • 2
  • the question asks about Heroku which is a `production` environment not `development` environment. – Masroor Oct 22 '20 at 08:31