Hubot-slack: Redis brain data seems to be missing Slack Names - hubot-auth related

Created on 21 Jul 2016  路  16Comments  路  Source: slackapi/hubot-slack

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

    Description

The redis brain data for user seems to be incomplete. I need to clarify if this is possibly a hubot-slack issue or more a hubot-auth issue.

The brain data seems to be incomplete for users. I am only get partial number of users (not all). Seems to be mostly just the users of the room it first joined. I assume this is expected?

But the user data only contains user ids, even the names are just user IDs at time. I try to flush the redis data and restart hubot to rebuild it but then I end up it not getting the user data at all.

"{\"users\":{},\"_private\":{\"roles\":{\"\\\"U1Q2S8DRT\":[\"admin\"],\"U1Q0YUDEF\\\"\":[\"admin\"],\"U1Q2S8DRT\":[\"admin\"],\"U1Q0YUDEF\":[\"admin\"]}}}"

Its like Hubot did not make the Slack API call to obtain the user list.

My Package JSON

{
  "name": "publisher-bot",
  "version": "0.0.0",
  "private": true,
  "author": "Publisher <publisher.campaigns>",
  "description": "Publisher",
  "dependencies": {
    "hubot": "^2.19.0",
    "hubot-auth": "^1.3.0",
    "hubot-diagnostics": "0.0.1",
    "hubot-help": "^0.2.0",
    "hubot-redis-brain": "0.0.3",
    "hubot-scripts": "^2.17.2",
    "hubot-slack": "^4.0.1"
  },
  "engines": {
    "node": "0.10.x"
  }
}

Reproducible in:

{project_name} version: 4.3.1
OS version(s): Ubuntu 14.04

Expected result:

Redis brain data will contain slack user IDs and proper name.

  • Name should be the proper name of the users
  • Should have a full list of users

Actual result:

  • only a few users show up
  • names are just the slack user IDs
bug

Most helpful comment

I think this should get bump from medium to high. As is breaks any form of authentication when using slack and leaves it completely open or unusable commands.

All 16 comments

also found the issue with hubot.brain not being used.

I think this should get bump from medium to high. As is breaks any form of authentication when using slack and leaves it completely open or unusable commands.

This also breaks hubot-rbac. Same kind of issue, obviously.

Bumping to high. Sorry this keeps getting delayed.

it looks like it's using the RTM datastore at the bottom of the script... this was not in the old code posted above.

https://github.com/slackhq/hubot-slack/blob/master/src/bot.coffee#L170

Is there any patch or workarround about this?

The only workaround I could found so far as nick suggest here is to revert hubot-auth to version v1.2.0 and hubot-slack to v3.4.2 till a fix is done for this. The steps I followed are as follow
1- npm uninstall --save hubot-slack
2- npm uninstall --save hubot-auth
3- npm install --save [email protected]
4- npm install --save [email protected]

Hope a fix is available soon for versions after 3.4.2

Can that the roll back mentioned by @asalaheldin works as a workaround for this problem for the time being, ran into it today with the hubot-keys script.

workaround mentioned by @asalaheldin worked. Thanks.
I am using hubot-auth and slack.
Thanks

Temporary workaround to re-instantiate Slack names.

I'm calling Slack's users.list() web API method to retrieve a list of users.

robot.brain.on 'loaded', (data) ->
  return unless robot.adapterName == 'slack'

  robot.adapter.client.web.users.list (err, info) ->
    if err
      robot.logger.debug 'Cannot retrieve list of users'
      return

    for member in info.members
      continue unless member?.id?
      newUser =
        name: member.name
        realName: member.real_name
        slack: member
      delete robot.brain.data.users[member.id]
      robot.brain.userForId member.id, newUser

Careful with the above workaround - by deleting the existing user info in the brain you will destroy any values already saved. For example - the hubot-auth list of roles that a user has. Or at least that was my experience.

Does #381 fix this? Does an upgrade mess up the brain?

As referenced by @sebastiandero and @ferrixh the #381 seems to be the fix of our issue here. I have just tried this and the users data have been loaded inside Hubot brain without any workaround just applied the new version of "hubot-slack" and "hubot-auth". Thanks a lot for mentioning this fix here guys

it sounds like the latest word is that this issue is fixed. if anyone finds evidence that its still not working correctly, please leave a comment.

Was this page helpful?
0 / 5 - 0 ratings