0

Hello guys thanks in advance for reading!

I have tried to figure out this part for a while now:

undefined method 'except' for "message: message":String

Don't seem to be able to figure it out or find anything on google.

Can someone please help out with some pointers would be greatly appreciated

Code: https://gist.github.com/qnoox/ae621d83a7b8047283a9d6108329f729

OutPut when it works: https://gist.github.com/qnoox/74fadc976b1dcee48be0a95abbf38afb

Thank you in advance!

EVX
  • 304
  • 4
  • 17
  • 1
    You're calling a method named `except` on the value `"message: message"`, which is a String, and the String class does not have a method named `except`. Without seeing your actual code it's impossible to tell you anything more. – Jordan Running Feb 09 '17 at 16:56
  • 1
    Looks like you might be expecting a hash – Mark Swardstrom Feb 09 '17 at 17:11
  • @Jordan Updated with code. – EVX Feb 09 '17 at 17:13
  • @Swards can you please explain a bit more in-depth? – EVX Feb 09 '17 at 17:16
  • 1
    you are calling speak with data['message'] been an string "message: message", when you call console.log message, what are you getting? – Alexis Feb 09 '17 at 17:25
  • console.log does not return anything on heroku as it errors out before it runs. so would data['message'].to_string work? – EVX Feb 09 '17 at 17:34
  • Hum, nope it will not as data['message'] will error before it hits .to_s. – EVX Feb 09 '17 at 17:41
  • @Alexis should i focus on converting it our redo the passing, this error is strange as it works on local but not when run on heroku, don't get it.. – EVX Feb 09 '17 at 17:59
  • i don't think a conversion would be the solution, as someones mentioned, seems that is expecting a hash, you should get ensure that you are sending a hash first, you could try to move console.log message before the call to speak to get a better idea of what is going on, but i don't really know that much about actioncable, sorry – Alexis Feb 09 '17 at 18:36
  • by the way, your file room.coffee seems to be missing some indentation, i guess is the copy-paste? – Alexis Feb 09 '17 at 18:39
  • I'm guessing the json script was messed up somewhere along the way, where the values were converted into strings. You'll have to dig back to see where the data: attribute was created. It should be a hash `{ :message => "..." }`, not a string. – Mark Swardstrom Feb 09 '17 at 22:35
  • I have added in a log of what it looks like when it works. (from local machine). – EVX Feb 10 '17 at 03:21
  • @Alexis Yeah must have lost indentation when pasting it into gist – EVX Feb 10 '17 at 03:22
  • @Swards i think this issue is because Redis/sidekiq is not handling the message correctly so this error forms might i be correct? – EVX Feb 10 '17 at 03:25
  • @Swards i was now able to get the console.log to work on heroku and the strange thing is room.coffee is answering on connected and console.log "live" but when using the speak it goes into room.js and uses that speak not the one from room.coffee – EVX Feb 10 '17 at 03:52

1 Answers1

1

Solution to this issue:

  1. Do not have room.js and room.coffee on heroku it gets confused.
  2. Remember to use rake assets:clean before push to heroku
  3. if you get except error this is beacuse of the fact that sidekiq is not catching your message to job request so make sure you configure your sidekiq and redis and actioncable 110% correct.
  4. Make sure indentation on room.coffee is correct
  5. now push to heroku git add . git commit -m "msg" git push heroku master
  6. Done it should now work!

Thank you to @Alexis @Swards @Jordan you guys helped me a lot with this. i'm very grateful!

EVX
  • 304
  • 4
  • 17