-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArgumentError (wrong number of arguments (given 2, expected 1)) #22
Comments
I also hit this today! I followed the steps in the anycable-rails README and encountered a very similar similar stacktrace when I ran it on these 2 combinations of versions:
It might just be that the README is a little out of date? I'm going to keep poking around. |
The problem is that you're trying to connect to Action Cable server and not to AnyCable (this line form backtrace You should set up Looks like your Action Cable server is mounted to your Rack stack. Do you have Also, how do you require |
Hello @palkan , Please let me know one things can we run application on different heroku server and we will use this url of that server config.action_cable.url = "" |
If I understand your question correctly (I'm not sure), then – yes, you should use the url of the second server (running RPC and anycable-go) as |
@palkan I get this error message as well. Your solution won't work for me, still getting the exact same error as @sandy1987. Fantastic work on anycable none the less. Can't wait to get it up and running. Actioncable truly is inefficiently designed. |
There is definitely something with configuration but it's not easy to figure our what exactly without having an access to the codebase. So, if it's possible, please, share your code with me. Otherwise let's try other ways. For example, it could be useful to see what's going on. Could you record a video demonstrating the problem? With server and browser network logs. Logs also could be useful: turn on debug mode (in Rails |
Hey guys, Maybe this helps you too. |
hm... it seems that I was wrong... the error still occurs and I get a handshake error even with setting |
@CR4567 Hm, when using AnyCable
The path is missing as I see, should be: |
@palkan ah thanks for the info... |
Hm, there should be new WebSocket('ws://testing.easierlife.de:3334/cable') |
oh boy... that was kind of stupid... |
@palkan I decided to redo the entire Heroku tutorial to the teeth, and while it seem to be connecting, I get a strange error when I try to send a chat message,
UPDATE UPDATE 2 I realized I had set the wrong gem in the gem file, now it's set as:
Printing ENV['CABLE_URL'] in console returns
But somehow it does not pick it up from the Procfile. Now I'm back to the exact same argument error as this post was originally created in the name of and I must stress that I have no problems with ActionCable in development. UPDATE 3 I can see now on startup that it is actually picking up the anycable-go URL. But yes, it is indeed stil trying to mount the connection on the main-app URL as seen here:
Somewhere it's not kosher... I'm going through the code in your demo as I write this, so I will be sure to post more updates. A question would be if it's required to use Docker or foreman? UPDATE 4 Procfile: bin/heroku-web
bin/anycable
production.rb ( I have tried setting this in application.rb too without any difference)
Should I store the ENV as a variable in heroku or does it read the CABLE_URL from procfile? – I can see the following on in the logs when starting up the main process on heroku:
But then right after:
Routes.rb
cable.js
Somehow, it simply does not want to connect to the correct host UPDATE 5 Which in the procfile is currently set as: However, it seems that this is somehow the wrong URL as I get a lot of weird errors in the Chrome console
(As you can see I'm using wss in my Procfile and not ws) I also get this in Chrome when visiting the main url of my app. Am I specifying the wrong anycable-go url? UPDATE 7 assets/javascripts/cable.js This removes the unsafe script warnings, but I'm still getting the same error as @CR4567 did before he managed to solve it, namely; Whyyyyyy..... |
@Crashtor Can you show me the logs for RPC app? Usually, 502 means that something went wrong with proxy (Heroku router?). There should be errors in the log.
You don't need this in your |
rpc log 2017-11-25T23:06:14.067927+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/cable" host=app-rpc.herokuapp.com request_id=c54cf39f-337a-4a5e-9be9-c4e438a75c9d fwd="80.216.213.189" dyno= connect= service= status=502 bytes= protocol=https 2017-11-25T23:06:21.578307+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/cable" host=app-rpc.herokuapp.com request_id=f86df7f8-eec1-4ce8-a17d-d603d74b04f1 fwd="80.216.213.189" dyno= connect= service= status=502 bytes= protocol=https 2017-11-25T23:06:43.219509+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/cable" host=app-rpc.herokuapp.com request_id=8d5b13f1-5937-4ca2-82c8-0ef3fdf68061 fwd="80.216.213.189" dyno= connect= service= status=502 bytes= protocol=https This is the anycable-go -log |
@Crashtor Hm, Heroku says that there is no applicant code (https://devcenter.heroku.com/articles/error-codes#h81-blank-app). Maybe, you forgot to push your repo to the second, RPC, remote? I've just noticed that this step is missing in the wiki. My bad( Updated. |
Ok yes, that was correct, I had not done that. Now I have however, and here are the logs from the rpc app: 2017-11-26T15:01:36.104484+00:00 heroku[web.1]: Starting process with command Here's what I've done |
@Crashtor Looks like your |
Yessss. Here we go! Now, using Devise, I ran into the auth_failed as described in the Heroku tutorial. |
🎉 🎉 🎉 |
hi @palkan! i just had this issue, and was wondering if you could clarify something about your answers? this link says to use Update 1I removed |
@birthdaycorp If it reaches Rails's router, it means that Just to make sure, that this option is set and passed properly, check |
thanks @sponomarev ! the meta tag in my dev environment says |
@birthdaycorp If you want to use AnyCable in all environments including development, make sure that you set Can you describe what happens when you do all of that? |
@sponomarev my config is set as I'll send a message to one user, the message will persist to the db, followed by an ActionCable broadcast
|
@birthdaycorp What shows the meta tag when you set Where do you set |
The meta tag says I have the |
@birthdaycorp Are you sure that the meta tag is shown on the page which invokes WS connect and? Check all layouts for |
I have Btw thanks so much for giving this attention on a holiday! <3 UpdateWhen I start my anycable-go server, I get this output:
INFO 2019-12-25T19:28:40.855Z context=http Starting HTTP server at localhost:3334 It's definitely connected to |
Update: I think I'm on the right path. I've managed to turn the previous error ( Currently getting to the bottom of that, but turns out I just needed t make sure that my |
Good catch! I'd suggest to create consumer on DOM load event instead, no reason to initiate the connection
Try to run |
Thanks for that DOM load suggestion, it was helpful. This is so weird, though. I'll change nothing, and it only works half the time. I'll run
Where is that |
What's in your
It's a part of the cookies. |
Thank you so much for your continued help with this! If I open Chrome inspector, I see that the cookie variables are all exactly the same as the output from I followed the Devise integration here, and managed to fix that
I guess a better way to phrase my question is: why is it taking a user model that I don't have in my database? This is my channels/application_cable/connection.rb file btw
|
Do you set |
Turns out I did have a cookie left over from the I'm still trying to figure out how to make this work, but... would you have any idea why the anycable console keeps spitting out |
Hello,
Please let me know the solution, So I will update the code as well
I have follow this links
https://github.com/anycable/anycable-rails
ArgumentError (wrong number of arguments (given 2, expected 1)):
anycable-rails (0.5.0) lib/anycable/rails/actioncable/connection.rb:29:in
initialize' actioncable (5.0.6) lib/action_cable/server/base.rb:28:in
new'actioncable (5.0.6) lib/action_cable/server/base.rb:28:in
call' actionpack (5.0.6) lib/action_dispatch/routing/mapper.rb:17:in
block in class:Constraints'actionpack (5.0.6) lib/action_dispatch/routing/mapper.rb:46:in
serve' actionpack (5.0.6) lib/action_dispatch/journey/router.rb:39:in
block in serve'actionpack (5.0.6) lib/action_dispatch/journey/router.rb:26:in
each' actionpack (5.0.6) lib/action_dispatch/journey/router.rb:26:in
serve'actionpack (5.0.6) lib/action_dispatch/routing/route_set.rb:727:in
call' warden (1.2.7) lib/warden/manager.rb:36:in
block in call'warden (1.2.7) lib/warden/manager.rb:35:in
catch' warden (1.2.7) lib/warden/manager.rb:35:in
call'rack (2.0.3) lib/rack/etag.rb:25:in
call' rack (2.0.3) lib/rack/conditional_get.rb:25:in
call'rack (2.0.3) lib/rack/head.rb:12:in
call' rack (2.0.3) lib/rack/session/abstract/id.rb:232:in
context'rack (2.0.3) lib/rack/session/abstract/id.rb:226:in
call' actionpack (5.0.6) lib/action_dispatch/middleware/cookies.rb:613:in
call'activerecord (5.0.6) lib/active_record/migration.rb:553:in
call' actionpack (5.0.6) lib/action_dispatch/middleware/callbacks.rb:38:in
block in call'activesupport (5.0.6) lib/active_support/callbacks.rb:97:in
__run_callbacks__' activesupport (5.0.6) lib/active_support/callbacks.rb:750:in
_run_call_callbacks'activesupport (5.0.6) lib/active_support/callbacks.rb:90:in
run_callbacks' actionpack (5.0.6) lib/action_dispatch/middleware/callbacks.rb:36:in
call'actionpack (5.0.6) lib/action_dispatch/middleware/executor.rb:12:in
call' actionpack (5.0.6) lib/action_dispatch/middleware/remote_ip.rb:79:in
call'actionpack (5.0.6) lib/action_dispatch/middleware/debug_exceptions.rb:49:in
call' web-console (3.5.1) lib/web_console/middleware.rb:135:in
call_app'web-console (3.5.1) lib/web_console/middleware.rb:28:in
block in call' web-console (3.5.1) lib/web_console/middleware.rb:18:in
catch'web-console (3.5.1) lib/web_console/middleware.rb:18:in
call' actionpack (5.0.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in
call'railties (5.0.6) lib/rails/rack/logger.rb:36:in
call_app' railties (5.0.6) lib/rails/rack/logger.rb:24:in
block in call'activesupport (5.0.6) lib/active_support/tagged_logging.rb:69:in
block in tagged' activesupport (5.0.6) lib/active_support/tagged_logging.rb:26:in
tagged'activesupport (5.0.6) lib/active_support/tagged_logging.rb:69:in
tagged' railties (5.0.6) lib/rails/rack/logger.rb:24:in
call'sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in
call' actionpack (5.0.6) lib/action_dispatch/middleware/request_id.rb:24:in
call'rack (2.0.3) lib/rack/method_override.rb:22:in
call' rack (2.0.3) lib/rack/runtime.rb:22:in
call'activesupport (5.0.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in
call' actionpack (5.0.6) lib/action_dispatch/middleware/executor.rb:12:in
call'actionpack (5.0.6) lib/action_dispatch/middleware/static.rb:136:in
call' rack (2.0.3) lib/rack/sendfile.rb:111:in
call'railties (5.0.6) lib/rails/engine.rb:522:in
call' puma (3.11.0) lib/puma/configuration.rb:225:in
call'puma (3.11.0) lib/puma/server.rb:624:in
handle_request' puma (3.11.0) lib/puma/server.rb:438:in
process_client'puma (3.11.0) lib/puma/server.rb:302:in
block in run' puma (3.11.0) lib/puma/thread_pool.rb:120:in
block in spawn_thread'Rendering /home/yuva/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /home/yuva/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/yuva/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.1ms)
Rendering /home/yuva/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/yuva/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.3ms)
Rendering /home/yuva/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /home/yuva/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.3ms)
Rendered /home/yuva/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (23.3ms)
The text was updated successfully, but these errors were encountered: