question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Socket mode - Builtin client doesn't respect HTTP_PROXY env variable

See original GitHub issue

Reproducible in

The Slack SDK version

slack-bolt==1.3.0
slack-sdk==3.3.0

Python runtime version

Python 2.7.16

OS info

ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H114
Darwin Kernel Version 19.6.0: Tue Nov 10 00:10:30 PST 2020; root:xnu-6153.141.10~1/RELEASE_X86_64

Steps to reproduce:

export HTTPS_PROXY=proxy_address:8123
from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler

bot_token = os.environ.get("SLACK_BOT_TOKEN")
app_token = os.environ.get("SLACK_APP_TOKEN")

app = App(token=bot_token)
socketAdapator = SocketModeHandler(
    app,
    app_token,
)

Expected result:

Working application

Actual result:

INFO:slack_bolt.App:The session seems to be already closed. Going to reconnect...
INFO:slack_bolt.App:A new session has been established
INFO:slack_bolt.App:⚡️ Bolt app is running!
INFO:slack_bolt.App:Starting to receive messages from a new connection
ERROR:slack_bolt.App:on_error invoked (error: TimeoutError, message: [Errno 110] Connection timed out)
INFO:slack_bolt.App:Received CLOSE event. Going to reconnect...
INFO:slack_bolt.App:Stopped receiving messages from a connection
INFO:slack_bolt.App:Starting to receive messages from a new connection
ERROR:slack_bolt.App:on_error invoked (error: TimeoutError, message: [Errno 110] Connection timed out)
INFO:slack_bolt.App:Received CLOSE event. Going to reconnect...
INFO:slack_bolt.App:Stopped receiving messages from a connection
INFO:slack_bolt.App:Starting to receive messages from a new connection
ERROR:slack_bolt.App:on_error invoked (error: TimeoutError, message: [Errno 110] Connection timed out)
INFO:slack_bolt.App:Received CLOSE event. Going to reconnect...
INFO:slack_bolt.App:Stopped receiving messages from a connection
INFO:slack_bolt.App:Starting to receive messages from a new connection

Requirements

N/A?

Workaround

Using the websocket_client handler, and specifying the proxy settings manually.

from slack_bolt import App
from slack_bolt.adapter.socket_mode.websocket_client import SocketModeHandler

bot_token = os.environ.get("SLACK_BOT_TOKEN")
app_token = os.environ.get("SLACK_APP_TOKEN")

app = App(token=bot_token)
socketAdapator = SocketModeHandler(
    app,
    app_token,
    http_proxy_host="proxy_host",
    http_proxy_port="3128",
)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
seratchcommented, Feb 9, 2021

Thanks for your reply. Will check later.

0reactions
seratchcommented, Feb 11, 2021

Thanks for reporting this issue and we appreciate your patience with this issue. For the env variable support, https://github.com/slackapi/python-slack-sdk/pull/953 will be included in the next minor version (=v3.4)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gdata Python Module - HTTP(s) Proxy via Environment Variable
I would like to use Fiddler (a HTTP(s) Proxy), to see what gcalcli sends/receives to/from Google. By their documentation it states, that I...
Read more >
mod_proxy - Apache HTTP Server Version 2.4
Apache HTTP Server can be configured in both a forward and reverse proxy (also known as gateway ) mode. An ordinary forward proxy...
Read more >
Configuration — Boto3 Docs 1.17.39 documentation
A Config object that's created and passed as the config parameter when creating a client; Environment variables; The ~/.aws/config file. Note. Configurations ...
Read more >
Configure Docker to use a proxy server - Docker Documentation
How to configure the Docker client to use a proxy server. ... how to configure the Docker CLI to configure proxies via environment...
Read more >
Advanced Usage — Requests 2.28.1 documentation
Session Objects¶. The Session object allows you to persist certain parameters across requests. It also persists cookies across all requests made from the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found