Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hubot Slack Integration Issue #448

Closed
6 of 9 tasks
ghost opened this issue Nov 10, 2017 · 30 comments
Closed
6 of 9 tasks

Hubot Slack Integration Issue #448

ghost opened this issue Nov 10, 2017 · 30 comments
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented

Comments

@ghost
Copy link

ghost commented Nov 10, 2017

Description

Hubot doesn't start with slack adapter as parameter.

Describe your issue here.
Hi, I have downloaded and installed the latest version of Hubot in my Linux server. The bot is starting up fine in local instance; but, as I pass Hubot slack token and adapter as slack, it just gets stuck.

I have invoked the slack url from my server using curl, and it just responds fine. I was also able to post a test msg on SLACK #general channel using curl.

Few info for reference: ( I have also attached screenshots for reference)

  • Server where Hubot is installed:Linux

  • hubot-slack: 4.4.0

  • Following are the env variables I have in place: (within my Linux server)
    (I have removed the host, port, and hubot token)
    export NODEJS_HOME=/usr/lib/nodejs/node-v8.9.0
    export PATH=$NODEJS_HOME/bin:$PATH
    export https_proxy=HOST:PORT
    export http_proxy=HOST:PORT
    export HUBOT_SLACK_TOKEN=xTOKEN
    export HUBOT_LOG_LEVEL="debug"

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

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

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

hubot-slack version:4.4.0

node version: 5.5.1

OS version(s):Red Hat Enterprise Linux Server release 6.9 (Santiago)

Steps to reproduce:

1.Install hubot (npm install -g yo generator-hubot)
2.Configure Hubot to use slack as adapter(yo hubot --adapter=slack)
3.Start hubot by passing the slack token as parameter:
HUBOT_SLACK_TOKEN=x********* bin/hubot --adapter slack

Expected result:

What you expected to happen
Hubot should start up and connect to slack channel as per the token.

Actual result:

The bot just doesn't come up and fails to give me the interactive command prompt.

What actually happened
The bot just doesn't come up and appears to get hung.

PFB all screenshots for reference:

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.
curl_example_latest
hubot_local_instance_startup_e1
hubot_with_slack_token_getting_stuck

@lornajane
Copy link
Contributor

I have this same issue. My existing hubot with slack integration stopped working part way through last week. I looked at it today, it was starting but giving no output at all, even with debug enabled. Dug around and it does error if you don't provide a slack token or the token is refused. I upgraded my hubot-slack library to 4.4.0 and now I get the same output as above:

[Tue Nov 14 2017 17:35:07 GMT+0000 (GMT)] DEBUG Loading adapter slack
[Tue Nov 14 2017 17:35:07 GMT+0000 (GMT)] DEBUG slack rtm client options: undefined
[Tue Nov 14 2017 17:35:07 GMT+0000 (GMT)] DEBUG slack rtm start with options: {}

It looks like it was expecting more environment variables but I can't find any docs on which ones. Any pointers would be gratefully received.

@lornajane
Copy link
Contributor

I think part of the issue here is that I'm an Enterprise Grid slack user, I'm not sure! My hubot has been working well with slack for about 6-9 months, it stopped about 2 weeks ago.

So far, I've found that the tokens aren't being passed to the RTM client, and that for enterprise slack I need to use the rtm.connect method. With this information, my command now looks like this: HUBOT_SLACK_TOKEN=xoxb-redacted HUBOT_SLACK_RTM_START_OPTS='{"token":"xoxb-redacted"}' HUBOT_SLACK_RTM_CLIENT_OPTS='{"useRtmConnect": "true"}' bin/hubot -a slack With this setup, I can get my bot connected to slack.

When I send my bot a message, I get another fatal error because the message data received does not contain all the expected fields. It looks like this:

{ type: 'message',
  channel: undefined,
  user: undefined,
  text: '@stacktesting-bot ping',
  ts: '1511435096.000157',
  source_team: 'T02J3DPUE',
  team: 'T02J3DPUE',
  rawText: '<@W6WBZQQFJ> ping',
  returnRawText: true }

I'm not sure if this is relevant, intentional, or should be in a separate bug. Just trying to be verbose in case it helps anyone!

@ghost
Copy link
Author

ghost commented Nov 28, 2017

Still no luck for me. I tried doing the same as you mentioned above, but the bot just doesn't come up.

[Mon Nov 27 2017 23:35:15 GMT-0700 (MST)] DEBUG Loading adapter slack
[Mon Nov 27 2017 23:35:15 GMT-0700 (MST)] DEBUG slack rtm client options: {"useRtmConnect":"true"}
[Mon Nov 27 2017 23:35:15 GMT-0700 (MST)] DEBUG slack rtm start with options: {"token":"xo***"}

@lornajane
Copy link
Contributor

It looks like you need the code change that is in the referenced pull request as well as just sending the token manually in the config. This allows my bot to log in but it crashes when it receives a message.

The bot error when a message arrives is because of the missing fields as I posted above - however those fields are populated when the message first arrives in the node SDK - but something goes wrong in the user lookup step so by the time hubot gets it, the fields are empty. It seems like this slack/hubot combination isn't particularly common, or maybe it's hard to support it for enterprise gateway customers. Either way, I've got an existing application with broken slack integration so I'll probably have to reimplement it with an alternative slack solution, I don't think I can make any more progress on bug fixing this and I didn't get a response to my first PR.

@Roach Roach added the RTM label Nov 28, 2017
@aoberoi
Copy link
Contributor

aoberoi commented Dec 14, 2017

sorry for the delay in response here folks, im on top of this issue now.

@lornajane big thanks for PR #452 and @Roach for narrowing down the high level problem in #453.

@niladrisb29 can i just get clarification that the hang you first experienced was also while connecting to a relatively large (in number of users) workspace? @lornajane and @niladrisb29 would you mind confirming that when connecting to a smaller workspace, without the useRtmConnect option set, that hubot starts up correctly? if that's not easy or possible to test, i understand, but it would be really useful.

there's a few ideas i have about solving this issue, but it boils down to trying to get this hubot adapter independent of the RtmClient dataStore object (#385). this will be tricky to get right because we will need to add code that queries the Web API for any data that isn't available in the dataStore so that the message properties are all preserved by the time your scripts handle them. its also tricky because i personally cannot test this on a team that is very large (but I'll work on getting access to one internally if i can). one idea i have is to use pagination on endpoints that tend to time out on large teams (e.g. users.list) so that we don't blow up or hang on a 500 response from the API.

i'm going to make fixing this issue my top priority for the remainder of the week and i'll update this ticket with the progress I make. this might involve merging #452, but i need some more time to investigate.

@aoberoi aoberoi added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented and removed RTM labels Dec 14, 2017
@aoberoi
Copy link
Contributor

aoberoi commented Dec 14, 2017

Here are the immediate tasks I've identified to help solve this issue:

Sorry, something went wrong.

@lornajane
Copy link
Contributor

I took a similar approach (ended up moving away from hubot in the process but still happy to help with getting this fixed for others if I can) https://lornajane.net/posts/2017/slack-enterprise-grid-and-botkit. I do have access to a pretty large org that I can do a little bit of testing on if that helps

@aoberoi
Copy link
Contributor

aoberoi commented Dec 17, 2017

Update: user.list pagination is implemented in #454

@aoberoi
Copy link
Contributor

aoberoi commented Dec 18, 2017

Update: identified SlackFormatter as an API that needs to be revised: #456

@paulsancer
Copy link

I have the same problem as in the last screenshot, it just hangs!
It started to fail all out of the sudden one day. I am behind a corporate proxy but that wasn't a problem before just configured it and it worked.

I checked everything in my environment, it works on docker but I can't run docker forever.

@aoberoi
Copy link
Contributor

aoberoi commented Jan 17, 2018

@polkien how large of a team are you trying to connect to?

we haven't made a release since the users.list change above has been merged, but i hope to get one out before the end of this week. if its a significantly large team, there's a good chance that release will solve this issue for you.

@paulsancer
Copy link

@aoberoi my team is not that large, it is less than 10 users right now.

If that was the problem it would be a problem when running on docker node:alpine too but it is not... I am trying on windows and it was just fine last year before holidays, came back to work and I found this issue. Don't know what to do now jeje.

@aoberoi
Copy link
Contributor

aoberoi commented Jan 18, 2018

@polkien i just tried on Windows and it connected, so i guess we'll have to dig a bit deeper. can you please create a new Issue, i think this isn't the same issue as the one being discussed here. once you do, i can to dig deeper with you.

@aoberoi
Copy link
Contributor

aoberoi commented Jan 31, 2018

some progress being made in #461

@paulsancer
Copy link

@aoberoi I realized the issue is with my laptop only when I am connected through a proxy, even with all proxy settings in place (I think!). I will have to figure out the problem in my configuration because it works pretty well from a home network. Sorry for the trouble :$!

@npithadi
Copy link

@here I have similar type of issue .I am trying to integrate hubot with slack. I am trying to run hello world hubot program .

Steps tried:-
1.Install hubot (npm install -g yo generator-hubot)
2.Configure Hubot to use slack as adapter(yo hubot --adapter=slack)
3.Start hubot by passing the slack token as parameter:
HUBOT_SLACK_TOKEN=x********* bin/hubot --adapter slack

I also copied " hello-world.coffee" inside /scripts directory of hubot installation . I also
mentioned "hubot-hello-world" inside external-scripts.json .

After executing below command , I am not able to get any response from hubot. I have pass
command "hubot hello" to my slack bot and so was expecting some response from hubot , but it does not respond.

$ HUBOT_SLACK_TOKEN=xoxb-308094275906-fIKtZ7nPBIKw5UUWSAQu42xq bin/hubot --adapter slack
npm WARN hubot-help@0.2.2 requires a peer of coffee-script@^1.12.6 but none was installed.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
event_type[Tue Feb 13 2018 12:29:21 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 1518505161243ms, treating error as keep-alive
[Tue Feb 13 2018 12:29:21 GMT+0530 (IST)] ERROR undefined
warn: Reconnecting, on attempt 1
[Tue Feb 13 2018 12:30:21 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 60740ms, treating error as keep-alive
[Tue Feb 13 2018 12:30:21 GMT+0530 (IST)] ERROR undefined
warn: Reconnecting, on attempt 2
[Tue Feb 13 2018 12:31:24 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 62874ms, treating error as keep-alive
[Tue Feb 13 2018 12:31:24 GMT+0530 (IST)] ERROR undefined
warn: Reconnecting, on attempt 3
[Tue Feb 13 2018 12:32:20 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 55364ms, treating error as keep-alive
[Tue Feb 13 2018 12:32:20 GMT+0530 (IST)] ERROR undefined
warn: Reconnecting, on attempt 4
[Tue Feb 13 2018 12:33:19 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 59148ms, treating error as keep-alive
[Tue Feb 13 2018 12:33:19 GMT+0530 (IST)] ERROR undefined

Any idea??

@paulsancer
Copy link

@npithadi that happens to me only when I am at work (behind my company's proxy), it sometimes connects after many attempts.

@npithadi
Copy link

@polkien But I am not able to connect even in my company's network. I wanted this working

@paulsancer
Copy link

@npithadi I got it working by setting the following environment variables in windows:

HTTP_PROXY
HTTPS_PROXY

(pointing to the same proxy server)
Hope it works for you as well..

@npithadi
Copy link

@polkien I am using MAC OS. What are the setttings for it?

@paulsancer
Copy link

@npithadi it should be the same I think (remember this is for nodejs), if those two doesn't work, I would try with:

PROXY
HTTP_PROXY
HTTPS_PROXY
HTTP-PROXY
HTTPS-PROXY

You can test with temporary variables by running (this will be effective in the current terminal session):

export HTTP_PROXY=http://your.proxy.server:port/

Please take a look at how to set environment variables for referece.

@aoberoi
Copy link
Contributor

aoberoi commented Mar 30, 2018

@polkien no problem! if you're looking for information about how to use this Hubot adapter behind a proxy, the answer is in this comment: #372 (comment)

@npithadi i'm not sure your issue is the proxy settings, but i also don't think its the same as this issue. can you start a new issue and describe your issue by filling out the template?

@aoberoi
Copy link
Contributor

aoberoi commented Mar 30, 2018

this issue should be fixed by #465

@npithadi
Copy link

@aoberoi I am able to fix this.

@AndreasHogan
Copy link

@npithadi hey did you solved the issue?. I am having the exact issue as you said above. My hubot is running fine in cmd but when integrated with slack I am not getting any responses. The bot turns green when ./bin/hubot.cmd -a slack is executed. I am looking for help. It was working fine 2 days back and suddenly I am not getting any responses.

Error:

npm WARN hubot-help@0.2.2 requires a peer of coffee-script@^1.12.6 but none is installed. You must install peer dependencies yourself.

up to date in 1.461s
[Mon Jun 18 2018 10:11:57 GMT+0530 (India Standard Time)] INFO hubot-slack adapter v4.5.1
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
[Mon Jun 18 2018 10:11:57 GMT+0530 (India Standard Time)] INFO Logged in as @thor in workspace galaxy
[Mon Jun 18 2018 10:11:58 GMT+0530 (India Standard Time)] INFO Connected to Slack RTM
[Mon Jun 18 2018 10:11:58 GMT+0530 (India Standard Time)] WARNING Loading scripts from hubot-scripts.json is deprecated and will be removed in 3.0 (github/hubot-scripts#1113) in favor of packages for each script.

Your hubot-scripts.json is empty, so you just need to remove it.
[Mon Jun 18 2018 10:11:58 GMT+0530 (India Standard Time)] ERROR hubot-heroku-keepalive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web.url | cut -d= -f2)
[Mon Jun 18 2018 10:11:58 GMT+0530 (India Standard Time)] INFO hubot-redis-brain: Using default redis on localhost:6379
[Mon Jun 18 2018 10:11:58 GMT+0530 (India Standard Time)] INFO hubot-redis-brain: Data for hubot brain retrieved from Redis

@npithadi
Copy link

@ActivBytes I am not able to solve this issue on MAC OS. i have installed it on linux vm.

@AndreasHogan
Copy link

@npithadi These are my latest errors:

C:\Users\ADMIN\Desktop\hello>.\bin\hubot.cmd -a slack
npm WARN hubot-help@0.2.2 requires a peer of coffee-script@^1.12.6 but none is installed. You must install peer dependencies yourself.

audited 371 packages in 3.055s
found 22 vulnerabilities (12 low, 2 moderate, 8 high)
run npm audit fix to fix them, or npm audit for details
[Mon Jun 18 2018 12:04:39 GMT+0530 (India Standard Time)] INFO hubot-slack adapter v4.5.1
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
error: Response not OK: invalid_auth
error: Disconnecting because invalid_auth is not recoverable
error: message=invalid_auth, stack=Error: invalid_auth
at handleHttpResponse (C:\Users\ADMIN\Desktop\hello\node_modules@slack\client\lib\clients\transports\call-transport.js:103:17)
at handleTransportResponse (C:\Users\ADMIN\Desktop\hello\node_modules@slack\client\lib\clients\transports\call-transport.js:153:19)
at apply (C:\Users\ADMIN\Desktop\hello\node_modules@slack\client\node_modules\lodash\lodash.js:478:17)
at wrapper (C:\Users\ADMIN\Desktop\hello\node_modules@slack\client\node_modules\lodash\lodash.js:5337:16)
at Request.handleRequestTranportRes (C:\Users\ADMIN\Desktop\hello\node_modules@slack\client\lib\clients\transports\request.js:21:5)
at apply (C:\Users\ADMIN\Desktop\hello\node_modules@slack\client\node_modules\lodash\lodash.js:478:17)
at Request.wrapper [as _callback] (C:\Users\ADMIN\Desktop\hello\node_modules@slack\client\node_modules\lodash\lodash.js:5337:16)
at Request.self.callback (C:\Users\ADMIN\Desktop\hello\node_modules\request\request.js:186:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (C:\Users\ADMIN\Desktop\hello\node_modules\request\request.js:1060:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage. (C:\Users\ADMIN\Desktop\hello\node_modules\request\request.js:980:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

error: Response not OK: invalid_auth
[Mon Jun 18 2018 12:04:39 GMT+0530 (India Standard Time)] ERROR Can't fetch users

Anyone out there who successfully installed in windows machine.

@AndreasHogan
Copy link

@lornajane issue solved? I am facing the same in windows machine

@aoberoi
Copy link
Contributor

aoberoi commented Jun 25, 2018

@AndreasHogan i don't think your issue is the same that was referenced above. the invalid_auth error means that the token is not correct. the token must be set with the environment variable HUBOT_SLACK_TOKEN. in the documentation, we link to the Hubot guide for deploying to Windows. that page contains an example of how to set an environment variable. i suggest you follow that guide.

i'm going to close this issue because the original issue is fixed, but if you're still having difficulty, feel free to open a new issue.

@aoberoi aoberoi closed this as completed Jun 25, 2018
@nehaLohia27
Copy link

@here I have similar type of issue .I am trying to integrate hubot with slack. I am trying to run hello world hubot program .

Steps tried:-
1.Install hubot (npm install -g yo generator-hubot)
2.Configure Hubot to use slack as adapter(yo hubot --adapter=slack)
3.Start hubot by passing the slack token as parameter:
HUBOT_SLACK_TOKEN=x********* bin/hubot --adapter slack

I also copied " hello-world.coffee" inside /scripts directory of hubot installation . I also
mentioned "hubot-hello-world" inside external-scripts.json .

After executing below command , I am not able to get any response from hubot. I have pass
command "hubot hello" to my slack bot and so was expecting some response from hubot , but it does not respond.

npm WARN hubot-help@0.2.2 requires a peer of coffee-script@^1.12.6 but none was installed.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
event_type[Tue Feb 13 2018 12:29:21 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 1518505161243ms, treating error as keep-alive
[Tue Feb 13 2018 12:29:21 GMT+0530 (IST)] ERROR undefined
warn: Reconnecting, on attempt 1
[Tue Feb 13 2018 12:30:21 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 60740ms, treating error as keep-alive
[Tue Feb 13 2018 12:30:21 GMT+0530 (IST)] ERROR undefined
warn: Reconnecting, on attempt 2
[Tue Feb 13 2018 12:31:24 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 62874ms, treating error as keep-alive
[Tue Feb 13 2018 12:31:24 GMT+0530 (IST)] ERROR undefined
warn: Reconnecting, on attempt 3
[Tue Feb 13 2018 12:32:20 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 55364ms, treating error as keep-alive
[Tue Feb 13 2018 12:32:20 GMT+0530 (IST)] ERROR undefined
warn: Reconnecting, on attempt 4
[Tue Feb 13 2018 12:33:19 GMT+0530 (IST)] INFO Logged in as cam-cloud of IBM Watson Cloud Platform
warn: No pong in 59148ms, treating error as keep-alive
[Tue Feb 13 2018 12:33:19 GMT+0530 (IST)] ERROR undefined

Any idea??

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented
Projects
None yet
Development

No branches or pull requests

7 participants