-
Notifications
You must be signed in to change notification settings - Fork 835
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
Failed to receive or enqueue a message: TypeError, object of type 'ServerTimeoutError' has no len() #1622
Comments
Hi @lingfish, thanks for reporting this issue. I am still unsure why this could happen in the code yet (message_data in the code cannot be an exception, this is the confusion I'm having), but once our team figures the cause out, changes to resolve it would be included in future releases. |
🤔 This seems like an odd one, from what I can tell the error was caught in the exception block but this seems to an aiohttp ServerTimeoutError From what I can gather error comes up when the connection with the server is established, but some reading from socket takes too long. (source) I tried reproducing this behavior in a unit test but wasn't able to 🤔 @lingfish is there any more stack-trace you could share with us? I'm having a hard time figuring out where |
Yeah, I've been struggling for days now to try to trigger this via tests, to no avail. BUT! I decided to literally break the network using a blackhole route, and I modified the exception block to actually log an exception, and here it is: 2024-12-24 10:52:49,998 ERROR __main__ Failed to receive or enqueue a message: TypeError, object of type 'ServerTimeoutError' has no len() (s_8788050674129)
2024-12-24 10:52:50,021 ERROR __main__ object of type 'ServerTimeoutError' has no len()
Traceback (most recent call last):
File "/srv/virtualenv/fishbot-oMssWodV/lib/python3.11/site-packages/slack_sdk/socket_mode/aiohttp/__init__.py", line 244, in receive_messages
if message_data is not None and len(message_data) > 0:
^^^^^^^^^^^^^^^^^
TypeError: object of type 'ServerTimeoutError' has no len() Not sure about the decision to not re-raise exceptions in So it happens here. Putting in a little logging with a 2024-12-24 11:23:37,998 INFO __main__ <class 'aiohttp.client_exceptions.ServerTimeoutError'>
2024-12-24 11:23:37,998 ERROR __main__ Failed to receive or enqueue a message: TypeError, object of type 'ServerTimeoutError' has no len() (s_8729441075225)
2024-12-24 11:23:38,031 ERROR __main__ object of type 'ServerTimeoutError' has no len()
Traceback (most recent call last):
File "/srv/virtualenv/fishbot-oMssWodV/lib/python3.11/site-packages/slack_sdk/socket_mode/aiohttp/__init__.py", line 246, in receive_messages
if message_data is not None and len(message_data) > 0:
^^^^^^^^^^^^^^^^^
TypeError: object of type 'ServerTimeoutError' has no len() Hopefully this helps. |
Thanks for sharing more details. It seems our code needs more check before calling len() at the line of code. We'll improve it in future releases. If anyone is happy to help us for it, any contributions will be appreciated. |
I'm seeing similar to #1458. My log though says:
The
ServerTimeoutError
I think is coming from aiohttp.I believe it is related to this exception:
Reproducible in:
slack_bolt 1.21.2 slack_sdk 3.33.4 Python 3.11.2 #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-1 (2024-08-05T16:17Z)
The Slack SDK version
As above.
Python runtime version
As above.
OS info
As above.
Steps to reproduce:
Actual result:
As above.
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.
The text was updated successfully, but these errors were encountered: