Skip to content
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

hubot-auth just won't work for me #36

Open
lwhitworth opened this issue Jul 6, 2016 · 11 comments
Open

hubot-auth just won't work for me #36

lwhitworth opened this issue Jul 6, 2016 · 11 comments

Comments

@lwhitworth
Copy link

Having a few issues (aplogies if I'm just being stupid):

When I run "what roles do I have" hubot returns nothing, debug looks like:

[Wed Jul 06 2016 13:27:50 GMT+0100 (BST)] DEBUG From: 1gu5otii6baaaaamanz3h1kear, To: 5cdpm7euotaaaaaa1ca5agt8je
[Wed Jul 06 2016 13:27:50 GMT+0100 (BST)] DEBUG Received message from user_mcuser: what roles do I have
[Wed Jul 06 2016 13:27:50 GMT+0100 (BST)] DEBUG Message sent to hubot brain.
[Wed Jul 06 2016 13:27:50 GMT+0100 (BST)] DEBUG Message 'bob what roles do I have' matched regex //^\s*[@]?bob[:,]?\s*(?:what roles? do(es)? @?([^\s]+) have\?*$)/i/; listener.options = { id: null }
[Wed Jul 06 2016 13:27:50 GMT+0100 (BST)] DEBUG Executing listener callback for Message 'bob what roles do I have'
[Wed Jul 06 2016 13:27:50 GMT+0100 (BST)] ERROR TypeError: Cannot read property 'length' of undefined
  at TextListener.callback (/opt/hubot/node_modules/hubot-auth/src/auth.coffee:136:17)
  at /opt/hubot/node_modules/hubot/src/listener.coffee:65:12
  at allDone (/opt/hubot/node_modules/hubot/src/middleware.coffee:44:37)
  at /opt/hubot/node_modules/hubot/node_modules/async/lib/async.js:274:13
  at Object.async.eachSeries (/opt/hubot/node_modules/hubot/node_modules/async/lib/async.js:142:20)
  at Object.async.reduce (/opt/hubot/node_modules/hubot/node_modules/async/lib/async.js:268:15)
  at /opt/hubot/node_modules/hubot/src/middleware.coffee:49:13
  at nextTickCallbackWith0Args (node.js:420:9)
  at process._tickCallback (node.js:349:13)

Additionally despite having set the env variable:

echo $HUBOT_AUTH_ROLES
admin=1gu5otii6baaaaamanz3h1kear

Running "list assigned roles" returns:
@bob Sorry, only admins can list assigned roles.

Any tips on what might be occuring?

@patcon
Copy link
Member

patcon commented Jul 6, 2016

Sorry @lwhitworth, I'm not currently using this, so am not the best person to respond.

Might be worth poking around the issue queue or the git-blame logs and see who's actively using this, and perhaps @-mention them in this issue.

Also, I've been told hubot middleware might be the future of auth scripts, so might be worth investigating this:
https://github.com/therealklanni/hubot-auth-middleware

@cecilia-sanare
Copy link

I can reproduce the error, but not the scenario.

@lwhitworth you're using the campfire adapter, correct?

@lwhitworth
Copy link
Author

lwhitworth commented Jul 13, 2016

Nope I'm using the rocket chat adapter

On 13 Jul 2016, at 18:06, Ceci Woodward [email protected] wrote:

I can reproduce the error, but not the scenario.

@lwhitworth you're using the campfire adapter, correct?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@nsturnitin
Copy link

@patcon what do you mean by it being the future of auth-scripts? The project you linked hasn't been updated in 2 yrs! https://github.com/therealklanni/hubot-auth-middleware

@davesade
Copy link

It seems I got very similar issue. My intention is to use Hubot as AWS controller. Locally on my PC it works (hubot ec2 ls gave me correct answer), I think it's because I got my env variables set manually (export HUBOT_AWS_ACCESS_KEY_ID and others). When I try to call the very same command via Slack (Hubot being hosted on Heroku), I receive error "DescribeInstancesError: ConfigError: Missing region in config". I googled, that "hubot auth" might be the culprit, as AWS-SDK was unable to retreive env vars (but I'm only guessing).

hubot what roles does Shell have

ERROR TypeError: Cannot read property 'length' of undefined
  at TextListener.callback (/home/nexus/IdeaProjects/autobot/node_modules/hubot-auth/src/auth.coffee:136:17, <js>:177:20)
  at executeListener (/home/nexus/IdeaProjects/autobot/node_modules/hubot/src/listener.coffee:65:11, <js>:53:19)
  at allDone (/home/nexus/IdeaProjects/autobot/node_modules/hubot/src/middleware.coffee:44:37, <js>:34:16)
  at /home/nexus/IdeaProjects/autobot/node_modules/async/lib/async.js:274:13
  at Object.async.eachSeries (/home/nexus/IdeaProjects/autobot/node_modules/async/lib/async.js:142:20)
  at Object.async.reduce (/home/nexus/IdeaProjects/autobot/node_modules/async/lib/async.js:268:15)
  at /home/nexus/IdeaProjects/autobot/node_modules/hubot/src/middleware.coffee:49:7, <js>:37:22
  at nextTickCallbackWith0Args (node.js:420:9)
  at process._tickCallback (node.js:349:13)

Frankly speaking, I guess I got incorrectly set HUBOT_AUTH_ROLES - I'm actually not sure, what exactly should I type in. Anyway, it seems to be not related to error message above, or is it?

Any help appreciated!

@cecilia-sanare
Copy link

@lwhitworth Can you verify if this is still an issue with the latest version of hubot-auth?

@davesade
Copy link

Frankly speaking, I have solved my issue (it was not your auth module after all) elsewhere - now it seems to work :).

@Soulfire86
Copy link

If I need to open a new Issue, I can, but I am now having issues with auth working as far as matching. This only just started after upgrading to the latest version. The commands work fine. I can check who has roles, I can add/remove roles as an admin.

But in my scripts the check for the user's role is not working:
if robot.auth.hasRole(msg.envelope.user, 'dev')

I'm using the Slack adapter, and I'm out of ideas other than just rolling back to previous versions again.

@sebastiandero
Copy link
Contributor

@Soulfire86 try retrieving the user by Id from brain, I don't think the envelope user has any roles. So get the userById using the I'd of the envelope user

@Soulfire86
Copy link

@sebastiandero Yep! Actually just figured that out a few minutes ago. The userRoles(user) function used to handle this itself, but I see now it's since been changed. Know if there's a reason why it shouldn't just handle this for us?

Because if we're needing to retrieve the user from the brain now, the documentation is incorrect. The notes say to pass in the envelope user.

@sebastiandero
Copy link
Contributor

@Soulfire86 That would be a great (re)addition for sure! I do not know the reason and cant come up with one tbh.. Glad everything works now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

7 participants