(Filling out the following details about bugs will help us solve your issue sooner.)
Reproducible in:
pip freeze | grep slack
python --version
sw_vers && uname -v # or `ver`
The Slack SDK version
slack_bolt==1.21.3
slack_sdk==3.33.5
Python runtime version
OS info
ProductName: macOS
ProductVersion: 15.1.1
BuildVersion: 24B91
Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020
Steps to reproduce:
(Share the commands to run, source code, and project settings (e.g., setup.py))
- Install async related packages via pip:
pip install slack_bolt==1.21.3 aiohttp==3.11.10 websockets==14.1
- Set
SLACK_BOT_TOKEN and SLACK_APP_TOKEN env vars
- Run the following app script:
import os
import asyncio
from slack_bolt.async_app import AsyncApp
from slack_bolt.adapter.socket_mode.websockets import AsyncSocketModeHandler
# Initializes your app with your bot token and socket mode handler
app = AsyncApp(token=os.environ.get("SLACK_BOT_TOKEN"))
# Start your app
if __name__ == "__main__":
asyncio.run(AsyncSocketModeHandler(app, os.environ["SLACK_APP_TOKEN"]).start_async())
- Wait for 10 seconds
Expected result:
See ⚡️ Bolt app is running! on the terminal, then nothing else.
Actual result:
See ⚡️ Bolt app is running! on the terminal, then every 10 seconds see the following:
Failed to check the current session or reconnect to the server (error: AttributeError, message: 'ClientConnection' object has no attribute 'closed', session: s_123456789)
This is because at the following line, session.closed is no longer defined for websockets>=14. Instead, session.state should be used to check whether the session is closed.
|
if self.auto_reconnect_enabled and (session is None or session.closed): |
,
Related websockets documentations:
Requirements
For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
(Filling out the following details about bugs will help us solve your issue sooner.)
Reproducible in:
The Slack SDK version
Python runtime version
OS info
Steps to reproduce:
(Share the commands to run, source code, and project settings (e.g., setup.py))
pip install slack_bolt==1.21.3 aiohttp==3.11.10 websockets==14.1SLACK_BOT_TOKENandSLACK_APP_TOKENenv varsExpected result:
See
⚡️ Bolt app is running!on the terminal, then nothing else.Actual result:
See
⚡️ Bolt app is running!on the terminal, then every 10 seconds see the following:This is because at the following line,
session.closedis no longer defined forwebsockets>=14. Instead,session.stateshould be used to check whether the session is closed.python-slack-sdk/slack_sdk/socket_mode/websockets/__init__.py
Line 120 in a7223d9
Related websockets documentations:
Requirements
For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.