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

Document starting hubot-slack with a proxy #372

Closed
3 tasks done
resteinbock opened this issue Nov 9, 2016 · 9 comments · Fixed by #512
Closed
3 tasks done

Document starting hubot-slack with a proxy #372

resteinbock opened this issue Nov 9, 2016 · 9 comments · Fixed by #512
Labels
docs M-T: Documentation work only

Comments

@resteinbock
Copy link

  • 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.

Description

I have followed the guidance here and added proxy.coffee but hubot startup is hanging on loading the slack adapter before loading hubot scripts to process that configuration.

ie robot.adapter.once 'connected', loadScripts in hubot/node_modules/.bin/hubot line 166

From what I can tell, the proxiedRequestTransport from node_modules/@slack/client/lib/clients/transports/request.js is not being used on SlackClient.connect() because the options object in node_modules/hubot-slack/slack.coffee does not allow for options to be provided for proxies (there is only an option for token).

Reproducible in:

hubot version: 2.19.0
hubot-slack version: 4.2.1
@slack/client version: 3.6.0
OS version(s): ubuntu
Device(s): AWS EC2 instance

Steps to reproduce:

  1. Setup hubot with slack adapter behind a proxy server
  2. Restrict outbound traffic directly from the hubot server to only allow traffic to go through the proxy server
  3. Try to start hubot (the start command fails because the Slack adapter is unable to connect to Slack through the proxy)

Expected result:

The hubot slack adapter to respect standard HTTP_PROXY and HTTPS_PROXY environment variables and connect on hubot startup using connections through the proxy server. Otherwise use standard hubot settings to support proxies.

Actual result:

hubot start command fails because the Slack adapter is unable to connect to Slack through the proxy.

Attachments:

Script restart attempt #6 below was started with outbound traffic restricted to only allow traffic to go through the proxy server (failed hubot start). Script restart attempt #7 below opened hubot server traffic to all IP addresses on ports 80 and 443 (successful hubot start).

error: Forever detected script was killed by signal: SIGKILL
error: Script restart attempt #6
[Tue Nov 08 2016 16:36:29 GMT+0000 (UTC)] INFO Logged in as akitabot of AkitaBox
error: Forever detected script was killed by signal: SIGKILL
error: Script restart attempt #7
[Tue Nov 08 2016 16:37:13 GMT+0000 (UTC)] INFO Logged in as akitabot of AkitaBox
[Tue Nov 08 2016 16:37:13 GMT+0000 (UTC)] INFO Slack client now connected
Registered slack user with deploy perms: 1
@DEGoodmanWilson DEGoodmanWilson added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Priority—Medium labels Nov 9, 2016
@rqc
Copy link

rqc commented Nov 16, 2016

@resteinbock @DEGoodmanWilson I have been tracking this issue with websockets respecting the environment proxy in the slack api. A fix was merged and it is already available in version v3.6.1.

Could we bump the slack client API version to v3.6.1? Thanks!

@pietvandongen
Copy link

I've just freshly installed a bot, which loads version 3.6.1 of the client API and it still doesn't seem to work.

@ojacques
Copy link

ojacques commented Jan 6, 2017

@pietvandongen - I got caught by this... You must use lower case env variable for https_proxy or this won't work.
This works https_proxy=http://myproxy:port/ bin/hubot --adapter slack
This does not: HTTPS_PROXY=http://myproxy:port/ bin/hubot --adapter slack

@zl4bv
Copy link

zl4bv commented Mar 23, 2017

Further to @ojacques's observation:

https_proxy HTTPS_PROXY Works?
Set Not set Yes
Not set Set No
Set* Set* No

* Set to the same value

@Roach
Copy link
Contributor

Roach commented Mar 23, 2017

The startup script currently looks for https_proxy.

0ce771c#diff-44aca805fd3e634b2ed4f6bc2ccb0749

I feel like we should change this to uppercase, as is standard with most ENV variables.

@davidkarlsen
Copy link

Any movement on this?

@rqc
Copy link

rqc commented Aug 28, 2017

@davidkarlsen This has been working for me for a while now when setting http_proxy and https_proxy env vars.

@davidkarlsen
Copy link

davidkarlsen commented Aug 28, 2017

@rqc
For me it hangs when trying to connect the rtm web socket client. If ok why is the ticket still open? I generate my bot with yeoman

verbose: Attempting to connect via the RTM API
debug: { '0': 'connecting' }
verbose: Retrying url=https://slack.com/api/rtm.connect
verbose: Retrying url=https://slack.com/api/rtm.connect
verbose: Retrying url=https://slack.com/api/rtm.connect
verbose: Retrying url=https://slack.com/api/rtm.connect

could you list your npm's and versions?

@aoberoi
Copy link
Contributor

aoberoi commented Aug 29, 2017

the reason this issue wasn't closed is because we hadn't spent the time investigating whether there was a reproducible issue here. we took the time to conduct several tests today and were able to successfully connect using a proxy. i'll be turning this into a documentation issue because we should document this feature and how its expected to work.

all you need to do is set the https_proxy environment variable as noted above. for example:

HUBOT_SLACK_TOKEN=xoxb-YOUR-TOKEN-HERE https_proxy="http://localhost:8888" ./bin/hubot --adapter slack

@aoberoi aoberoi added docs M-T: Documentation work only and removed bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Priority—Medium labels Aug 29, 2017
@aoberoi aoberoi changed the title Unable to start hubot with slack adapter behind a proxy Document starting hubot-slack with a proxy Oct 18, 2017
aoberoi added a commit to aoberoi/hubot-slack that referenced this issue Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs M-T: Documentation work only
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants