-
Notifications
You must be signed in to change notification settings - Fork 250
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
Socket Mode: Failed to connect (error: string argument without an encoding) w/ Azure App Service + aiohttp 3.11.2 #1202
Comments
Update: I was able to get the app to work again, but I did have to revert back to older versions of slack_bolt/slack_sdk slack_bolt==1.20.1
requests==2.32.3
python-dotenv==1.0.1
slack_sdk==3.33.1
aiohttp==3.10.8
uvicorn==0.31.0
fastapi==0.115.0 |
Hi @jeremybeeman, thank you for writing in. I've reviewed all the changes between the versions you tried but we haven't made any changes to aiohttp modules.
I am thinking that your aiohttp minor version ugprade might cause the behavior difference.
The above error inside aiohttp library indeed could cause the "string argument without an encoding" error. If there is a way for our slack-sdk to implement a workaround for this aiohttp 3.11 issue, we may do so in future releases. For now, please lock the aiohttp version to 3.10.x. |
I'm also having this issue since upgrading from My """A Slack App to start a remote-dev instance on demand"""
import os
import asyncio
from dotenv import load_dotenv
from slack_bolt.async_app import AsyncApp
from slack_bolt.adapter.socket_mode.async_handler import AsyncSocketModeHandler
from logger import logger as log
from modules.handlers import SlackEventHandlers
from modules.helpers import SlackHelpers
async def main():
"""
This function starts the Slack app
"""
app = AsyncApp(
token=os.environ.get("SLACK_BOT_TOKEN"),
signing_secret=os.environ.get("SLACK_SIGNING_SECRET"),
)
event_handlers = SlackEventHandlers(app)
slack_helpers = SlackHelpers()
slack_helpers.check_required_env_vars()
log.info("Starting Slack app")
socket_mode_handler = AsyncSocketModeHandler(
event_handlers.app, os.environ["SLACK_APP_TOKEN"]
)
await socket_mode_handler.start_async()
if __name__ == "__main__":
asyncio.run(main()) Error:
As a workaround, I was able to start my app using websockets: from slack_bolt.adapter.socket_mode.websockets import AsyncSocketModeHandler But there are some client differences, I see warnings in my logs while my app runs:
I'll hold off upgrading to |
Received another feedback at slackapi/python-slack-sdk#1592 and it seems our aiohttp integration needs to adjust the code for this issue. New slack-sdk patch version will resolve it shortly |
Thank you for being patient with this issue. Upgrading slack-sdk 3.33.4 should resolve it: https://github.com/slackapi/python-slack-sdk/releases/tag/v3.33.4 |
Reproducible in:
The
slack_bolt
versionslack_bolt==1.21.2
Python runtime version
Python 3.12.2
OS info
Trying to run from an Azure App Service that is VNET integrated. All outbound connectivity is required to go via proxy.
OS version: Unix 5.15.164.1
64 bit system: True
64 bit process: True
Processor count: 1
Machine name: 2f7e55a2dc74
Instance id: 0e5af111c5b338ee855cdd761d032f2c022705d7e379fdcddb5270f11cfa1b68
Short instance id: 0e5af1
CLR version: 6.0.35
System directory:
Current working directory: /opt/Kudu
IIS command line: /opt/Kudu/Kudu.Services.Web.dll
(antenv) root@app-service:/home/site/wwwroot# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL=https://www.debian.org/
SUPPORT_URL=https://www.debian.org/support
BUG_REPORT_URL=https://bugs.debian.org/
(antenv) root@e9813d4e8a9f:/home/site/wwwroot# uname -r
5.15.164.1-1.cm2
Steps to reproduce:
Slack Bolt Socket Mode Snippet
The code snippet is used alongside a separate FastAPI instantiation and calls to a separate aiohttp Web Client.
Build and deploy the slack bolt code using the github actions deployment shown here: https://github.com/Azure/actions-workflow-samples/blob/master/AppService/python-webapp-on-azure.yml
Expected result:
To be able to create a socket connection between Slack and the app service.
Actual result:
The initial call to slack is made, and then the code then fails with a string encoding error with aiohttp (put XXXXX for some IDs).
Requirements
slack_bolt==1.21.2
requests==2.32.3
python-dotenv==1.0.1
slack_sdk==3.33.3
aiohttp==3.11.2
uvicorn==0.32.0
fastapi==0.115.5
The text was updated successfully, but these errors were encountered: