Lita not able to accept Room Join invites
GaryCarneiro opened this issue · comments
Hi,
I try inviting Lita to join Rooms using following commands by being in the room as well as on 1-on-1 chat (all through HipChat client for Mac OS X)
*** join 19873_devops **
#join 19873_devops
join #19873_devops
I have logged into the DevOps room and send invites but dont see *lita bot * accepting it or processing it.
Debug logs are here
Let me know if any further information is required.
I found a bug that I think may be causing the issue you're seeing. Please try lita-hipchat 1.6.1, which I just released, and see if the join command is still failing for you.
Hello,
I tried the new Gem and tried couple of things but doesnt seem to work :(
As earlier, I tried join commands as follows:
join 1972_devops
/join 1972_devops
#join 1972_devops
join #1972_devops
join '1972_devops'
Tried Inviting the bot from MacOSX Client Version 2.6 (98) using Room Menu > Invite Users ... > BotName
I also invited the Bot from Android Client Version 2.3.1
I see the invite being logged but nothing gettting executed.
I tried to modify the Gem libraries by appending following in ~/.rvm/gems/ruby-2.1.2/gems/lita-hipchat-1.6.1/lib/lita/adapters/hipchat/connector.rb Line 36
def join(muc_domain, room)
Lita.logger.debug "Got Join Request"
I am able to see the above string ( ie 'Got Join Request' ) for all rooms in config.adapter.rooms but not for Invites and Join's
The Ruby version is 2.1.2
Sorry for the trouble you're having! Unfortunately, I haven't been able to reproduce this myself with 1.6.1. We'll need to determine exactly where the join is failing (in Lita::Adapters::HipChat::Connector#join
).
When you send the join command, do you see either "Already in room with JID <JID>" or "Joining room: <JID>" in the Lita logs?
Of the five variations of messages you described in your last comment, the first one is the one you want: join 1972_devops
.
Trouble with OSS Projects ?? Naah! Its part of learning.
I see the message is gettting passed on to Lita but no action is being taken.
DEBUG: Dispatching PM to Lita from
DEBUG -- : RECEIVED:
DEBUG -- : PROCESSING:
The debug logs before any modification are at http://pastebin.com/m5dDiEcn
Modified ~/.rvm/gems/ruby-2.1.2/gems/lita-3.3.0/lib/lita/robot.rb
def receive(message)
Lita.logger.debug "LITA: Received Message #{message}"
Lita.handlers.each { |handler| handler.dispatch(self, message) }
end
Next modified to see if dispatch() is receiving command in ~/rvm./gems/ruby-2.1.2/gems/lita-3.3.0/lib/lita/handler.rb
def dispatch(robot, message)
Lita.logger.debug "LITA: Dispatch Code #{robot}, #{message}"
routes.each do |route|
next unless route_applies?(route, message, robot)
log_dispatch(route)
dispatch_to_route(route, robot, message)
end
end
I see the following logs:
[2014-07-08 15:27:54 UTC] DEBUG: LITA: Received Message #<Lita::Message:0x007fb0ca273800>
[2014-07-08 15:27:54 UTC] DEBUG: LITA: Dispatch Code #<Lita::Robot:0x007fb0c5667600>, #<Lita::Message:0x007fb0ca273800>
[2014-07-08 15:27:54 UTC] DEBUG: LITA: Dispatch Code #<Lita::Robot:0x007fb0c5667600>, #<Lita::Message:0x007fb0ca273800>
[2014-07-08 15:27:54 UTC] DEBUG: LITA: Dispatch Code #<Lita::Robot:0x007fb0c5667600>, #<Lita::Message:0x007fb0ca273800>
[2014-07-08 15:27:54 UTC] DEBUG: LITA: Dispatch Code #<Lita::Robot:0x007fb0c5667600>, #<Lita::Message:0x007fb0ca273800>
[2014-07-08 15:27:54 UTC] DEBUG: LITA: Dispatch Code #<Lita::Robot:0x007fb0c5667600>, #<Lita::Message:0x007fb0ca273800>
[2014-07-08 15:27:54 UTC] DEBUG: LITA: Dispatch Code #<Lita::Robot:0x007fb0c5667600>, #<Lita::Message:0x007fb0ca273800>
[2014-07-08 15:27:54 UTC] DEBUG: LITA: Dispatch Code #<Lita::Robot:0x007fb0c5667600>, #<Lita::Message:0x007fb0ca273800>
I can debug further if you could give me a pointer what the following code is doing:
routes.each do |route|
next unless route_applies?(route, message, robot)
log_dispatch(route)
dispatch_to_route(route, robot, message)
end
Sharing my configuration at http://pastebin.com/T7LXLStm
Thank you for your time.
Gary
I don't think there's a problem with the message getting dispatched to the correct route. It seems like something inside the HipChat adapter is the issue. Unfortunately invites are working on my setup, but if I had access to one where this problem was happening, I would start debugging it by adding additional debug logging to the join
method in https://github.com/jimmycuadra/lita-hipchat/blob/master/lib/lita/adapters/hipchat/connector.rb to see which individual lines are doing what is expected and where something unexpected might be happening.
Hello Jimmy,
I wont be able to give you access to environment having this issue. Sorry about that.
Suspect issues with muc_domain since this works flawlessly for you. I will email lita_config.rb to you.
I wasn't implying that you should share access to your HipChat account. Sorry if that wasn't clear! I was just trying to provide some tips for debugging on your end.
I appear to have something similar tanking my setup. I upgraded from 1.3.1 to 1.6.1 and it just seems to hang, never fully connecting. The Lita user shows as offline.
Interestingly, it did all its lookups of users and joined rooms, but then sort of came to a halt looking up a fake (API) user. Or at least that was the last message in the logs.
2014-10-08T02:07:19.607721+00:00 app[web.1]: [2014-10-08 02:07:19 UTC] DEBUG: Updating record for user with ID: 14943_685559@chat.hipchat.com.
2014-10-08T02:07:19.620039+00:00 app[web.1]: [2014-10-08 02:07:19 UTC] DEBUG: Updating record for user with ID: 14943_158201@chat.hipchat.com.
2014-10-08T02:07:19.630980+00:00 app[web.1]: [2014-10-08 02:07:19 UTC] DEBUG: Updating record for user with ID: 14943_1159164@chat.hipchat.com.
2014-10-08T02:07:19.637112+00:00 app[web.1]: [2014-10-08 02:07:19 UTC] DEBUG: Querying server for list of rooms.
2014-10-08T02:07:20.270007+00:00 app[web.1]: [2014-10-08 02:07:20 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:20.562025+00:00 app[web.1]: [2014-10-08 02:07:20 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:20.699094+00:00 app[web.1]: [2014-10-08 02:07:20 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:20.611793+00:00 app[web.1]: [2014-10-08 02:07:20 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:20.756399+00:00 app[web.1]: [2014-10-08 02:07:20 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:20.827484+00:00 app[web.1]: [2014-10-08 02:07:20 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:20.938598+00:00 app[web.1]: [2014-10-08 02:07:20 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:21.075002+00:00 app[web.1]: [2014-10-08 02:07:21 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:21.026796+00:00 app[web.1]: [2014-10-08 02:07:21 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:21.147827+00:00 app[web.1]: [2014-10-08 02:07:21 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:21.210370+00:00 app[web.1]: [2014-10-08 02:07:21 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:21.240071+00:00 app[web.1]: [2014-10-08 02:07:21 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:21.298335+00:00 app[web.1]: [2014-10-08 02:07:21 UTC] INFO: Joining room: 14943_redacted@conf.hipchat.com/Change Bot.
2014-10-08T02:07:21.305258+00:00 app[web.1]: [2014-10-08 02:07:21 UTC] DEBUG: Looking up user with name: Airbrake.
It doesn't seem like they were related, but just in case, try the newly release v1.6.2 which included the fix for #15 and see if this is still happening.
Yup, my report was actually about the problem diagnosed in #15 and v1.6.2 fixed it. Thanks.
Closing due to inactivity. If this is still a problem and there is any additional information that could help debug it, please reopen it! :)
I'm having this problem as well. Here are the steps to reproduce:
- Turn on lita hipchat debugging, set join rooms to ``:all`, start lita.
- From hipchat client on a Mac, create a new room, make it private, invite Lita.
- Note the XMPP being received via debug logs, but not being acted upon. Lita will appear to be in the room in the hipchat client, but won't respond.
- Restart lita. After being invited, Lita will pick up the availability of the new room via `list_rooms()``, join it, and will respond to commands.
This looks like a problem that has been solved in another bot: justinweiss/robut#41 I don't have any familiarity with lita_hubot, but a quick scan didn't show any results for the string 'invite'.
Can you reopen this? I'd love to help out if I can.
We are having issues with this as well in our implementation. I will try and track down why it is happening for us and see if I can fix our specific issue.
The reason this didn't work for me was that the join route is restricted to admins only.
https://github.com/jimmycuadra/lita/blob/master/lib/lita/handlers/room.rb#L7
Add your user's JID in lita_config under config.robot.admins, problem solved.
http://docs.lita.io/getting-started/usage/#authorization-groups
It won't work without config.adapters.hipchat.rooms = :all
,
After I added back config.adapters.hipchat.rooms = :all
and restart lita, it could join the rooms.
BUT! Every time after I invite lita to a new room, I have to restart lita to let it work ....
Exact same problem as described by justintime #10 (comment)
Looks like it doesn't successfully join the room after invited. Lita needed to restart in order for it to work.
After a lot of troubleshooting, I found the problem.
First, Lita doesn't automatically join on invitation. I got around this by overriding lita-hipchat's callback.rb to detect invitations and trigger an 'on invite' event. Then, in my handler for on invite, I join the room.
Upon joining, here is where the actual problem lies. I'm not exactly sure why but lita-hipchat connector's join method does some check and returns
Lita.logger.debug "Already in room with JID #{room_jid.bare.to_s}"
To get around that problem, I again monkey patched that method to skip the mucs check.
Hope this helps resolve this long standing issue.