Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 349 Vote(s) - 3.58 Average
  • 1
  • 2
  • 3
  • 4
  • 5
action cable subscribing locally, but not on heroku

#1
I've been trying everything I can find online, and nothing is working. Hoping some fresh eyes will see the issue. This is my first time using ActionCable, and everything works great locally, but when pushing to heroku. my logs do not show any actioncable subscriptions like my dev server:

[ActionCable] [[email protected]] MsgsChannel is streaming from msg_channel_34

and when sending a message, I do see `[ActionCable] Broadcasting to msg_channel_34:` but they are not appending, which I'm guessing means that the `received` method is not being accessed/called?

I do notice on heroku's logs it says `Listening on tcp://0.0.0.0:5000` where as dev it is listening at localhost:3000. Should I be pointnig towards my heroku app somehow?

Here are the relevant configuration files:

Procfile:

web: bundle exec puma -p 5000 ./config.ru
actioncable: bundle exec puma -p 28080 cable/config.ru
redis: redis-server

***Thanks to the comment below, I am also trying. Still not working, but I can see that the port it's listening to is changing, making me believe it has something to do with the configuration? :

web: bundle exec puma -p $PORT ./config.ru
actioncable: bundle exec puma -p $PORT cable/config.ru
redis: redis-server


/cable/config.ru

require ::File.expand_path('../../config/environment', __FILE__)
Rails.application.eager_load!

ActionCable.server.config.allowed_request_origins = ["http://localhost:3000"]
run ActionCable.server

config/environments/development.rb

config.action_cable.allowed_request_origins = ['localhost:3000']
config.action_cable.url = "ws://localhost:3000/cable"

config/environments/production.rb

config.web_socket_server_url = "wss://app-name.herokuapp.com/cable"
config.action_cable.allowed_request_origins = ['https://app-name.herokuapp.com', 'http://app-name.herokuapp.com']


config/cable.yml

local: &local
adapter: async
:url: redis://localhost:6379
:host: localhost
:port: 6379
:timeout: 1
:inline: true
development: *local
test: *local


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

`<%= ENV["REDISTOGO_URL"] %>` is set, confirmed by running heroku config

routes.rb


mount ActionCable.server => '/cable'



Why is this working on dev, but not on heroku? I've been reading for hours, but can not figure it out. Thank you!!



UPDATE:
heroku logs:

2017-01-25T20:32:57.329656+00:00 heroku[web.1]: Starting process with command `bundle exec puma -p 5000 ./config.ru`
2017-01-25T20:32:59.600554+00:00 app[web.1]: Puma starting in single mode...
2017-01-25T20:32:59.600574+00:00 app[web.1]: * Version 3.6.2 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
2017-01-25T20:32:59.600575+00:00 app[web.1]: * Min threads: 0, max threads: 16
2017-01-25T20:32:59.600577+00:00 app[web.1]: * Environment: production
2017-01-25T20:33:02.375128+00:00 app[web.1]: profile controller
2017-01-25T20:33:02.588653+00:00 app[web.1]: Use Ctrl-C to stop
2017-01-25T20:33:02.588446+00:00 app[web.1]: * Listening on tcp://0.0.0.0:5000
2017-01-25T20:33:17.681469+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-01-25T20:33:17.681469+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-01-25T20:33:17.862118+00:00 heroku[web.1]: Process exited with status 137
2017-01-25T20:33:57.501746+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-01-25T20:33:57.501908+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-01-25T20:33:57.630071+00:00 heroku[web.1]: Process exited with status 137
2017-01-25T20:33:57.642753+00:00 heroku[web.1]: State changed from starting to crashed

Reply

#2
Your procfile suggests that you run puma with cable/cable.ru on port 28080. Also - file cable/config.ru shouldn't contain this line:

ActionCable.server.config.allowed_request_origins = ["http://localhost:3000"]

You already configured this in config/environment/*.rb
Reply

#3
Is your app name literally `app-name`? I suspect not. Odds are pretty good that these values...

config.web_socket_server_url = "wss://app-name.herokuapp.com/cable"
config.action_cable.allowed_request_origins = ['https://app-name.herokuapp.com', 'http://app-name.herokuapp.com']

Need to be updated to use the actual public-facing URL you intend to connect to.
Reply

#4
The issue was my host is the heroku app, but the requests were coming from the custom domain.

To solve:

`heroku config:set RAILS_HOST "http://www.example.com"`

And then in production.rb:

`config.action_cable.url = "wss://#{ENV['RAILS_HOST']}/cable"`
Reply

#5
I had the same issue, and found the answer I needed [here: redis gem 4+ incompatibility "Specified 'redis' for Action Cable pubsub adapter, but the gem is not loaded"](

[To see links please register here]

). Once I downgraded my redis to 3.1.0, worked perfectly.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through