-
Notifications
You must be signed in to change notification settings - Fork 842
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
File Upload API succeeds despite 408 Request Timeout #1165
Comments
Hi @iamarjun, thanks for writing in! We recently received a similar feedback and that was due to some server-side issue: #1162 (comment) In the case where HTTP status 408 is returned from the server-side, the I'm sorry for bothering you again but would you mind contacting our customer support agents from either https://my.slack.com/help/requests/new or |
Hi @seratch, when I use curl to upload the file I get
Hence shifted to SDK, although the file gets uploaded I still get stream timeout, not sure what the problem is. |
That may be due to some connectivity issue between your host and Slack but I'm unable to help you out for it. Trying the same script in a different host may help for figuring out whether it's caused by Slack's workspace specific issue or network issues in your host. I hope this helps. |
@seratch initially I thought it was the CI Server that is causing the issue, but I could reproduce it locally as well. |
Hi @seratch here's the full log using curl
|
@iamarjun Thanks for sharing more details! I've checked internal reports and found that other people are also facing this server-side issue with relatively large size files (I know that your file is not so large but it seems that the situation can arise even with mega-byte-level size). The server-side engineering teams are working hard to eliminate (at least mitigate) the issue now but I cannot tell when the situation can be improved. The only workaround that I can suggest is that, if you receive the 408 error, your app can check files.list API results with the same token to know whether the upload was actually successful. If there is no new item in the response, your app needs to retry the same files.upload API call. We're sorry for the disruption. |
Even we are facing the same issue @seratch. We are not able to upload build artefacts to slack 😢 Keeping you in the loop here @jaypoojara. Let's follow this thread. |
Facing the same issue, trying to upload 60MB file using curl request, failing with stream timeout error.
|
Any other workaround? I'm trying the retry mechanism @seratch suggested but it is failing every time for me (408 and no actual message being posted). |
@locomike I'm sorry to say this but I don't have anything further that I can suggest at this moment. We will continue communicating with the server-side teams. |
I am facing the same issue, let me know once it's resolved. |
I am facing the same issue here. Subscribing for the updates |
1 similar comment
I am facing the same issue here. Subscribing for the updates |
Same here, failing all the time even after multiple retry. |
I see these intermittently. Re-trying even a minute later and the same files upload successfully without issue. The error was common two weeks ago, disappeared for a few weeks, and now it is back again today. |
Is there any correlation with file type? Can anyone else commend on the file types you are experiencing the problem with (binary vs text and also mime-type)? Maybe there is a correlation that will make this easier for the devs to repro. |
@mattpr we are seeing this issue with files that are Thus, file size/type does not seem to be a factor here. |
Interesting. We get this error consistently on every try (100%) with the ~33MB zip that is generated each day. |
Maybe a temporary workaround for those who are experiencing this issue intermittently. It retries three times each with a for file_name in files_list:
# Try up to three times because Slack file uploads are recently kinda flaky.
# @see https://github.com/slackapi/python-slack-sdk/issues/1165
tries = 3
for i in range(tries):
if i > 0:
print(f"Trying upload again for {file_name} (attempt {i+1} of {tries}) ...")
try:
# Limit to 20 calls per minute so we don't get rate-limited by Slack.
# @see https://api.slack.com/docs/rate-limits
if len(files_list) > 20:
time.sleep(3)
upload_result = client.files_upload(file=file_name)
logger.info(upload_result)
except SlackApiError as e:
logger.error(f"Error uploading file {file_name}. Attempt {i+1} of {tries}: {e}")
if i < tries - 1:
time.sleep(3)
continue
else:
raise
break Edit: We have been using the above for a week now. Normally it does not need more than one try. But occasionally it goes up to three tries, with the third try succeeding. |
I'm facing this same issue as well, on ~90% of tries, starting on 2022/02/22. In my case the files are all |
curl https://slack.com/api/files.upload --limit-rate 423K -F token="xoxb-PUT-YOUR-TOKEN-HERE" -F channels="#test-channel" -F title="TESTING! FileName.apk" -F filename="filename.txt" -F file="@/path/to/file/test_empty_file.txt" |
Thankyou 🙏 |
This issue is still happening for us. We're using Bolt JS, which automatically retries 9 times, and we end up spamming the customer's channel with the same message + file 10 times. We've tried the |
Also happening for me, not sure how to fix it without a library update. |
Hi all, let me share some updates on this issue. Firstly, sincere apologies for taking a long time to resolve this issue on the Slack platform side. We do understand that this issue has been critical for many people. As a solution, we just released v3.19.0, which includes a new method named response = client.files_upload_v2(
file="./logo.png",
title="New company logo",
# Note that channels still works but going with channel="C12345" is recommended
# channels=["C111", "C222"] is no longer supported. In this case, an exception can be thrown
channels=["C12345"],
initial_comment="Here is the latest version of our new company logo :wave:",
) The new method eliminates the timeouts. In addition, it enables 3rd party app developers to upload multiple files like humans do in Slack clients. This feature addition can be useful for many use cases. Here is a simple example code: response = client.files_upload_v2(
file_uploads=[
{
"file": "./logo.png",
"title": "New company logo",
},
{
"content": "Minutes ....",
"filename": "team-meeting-minutes-2022-03-01.md",
"title": "Team meeting minutes (2022-03-01)",
},
],
channel="C12345",
initial_comment="Here is the latest version of our new company logo :wave:",
)
response.get("files") # returns the full metadata of all the uploaded files Please refer to the release notes for more details: https://github.com/slackapi/python-slack-sdk/releases/tag/v3.19.0 |
Thanks for the update. Unfortunately the new method has the exact same issue (practically) for me in that the file uploads apparently fail...except they don't. They actually post to slack despite the API/slack_sdk error. Now it is every file, not just the big ones. Apparently a permission issue that is not actually a permission issue since the files upload.
The I guess I could fix the permission error issue by granting more permissions to the API token I am using but seems like a bug since the API allows me to post anyway? |
Hi @mattpr, thanks for writing in with details!
As the error code "missing_scope" indicates, the situation that you've encountered with v2 method is a different problem. I should have mentioned this, but the v2 method requires both So, please add
Thanks for sharing this. I will look into this later and definitely we can improve the v2 behavior to be consistent with v1 as much as possible. |
Thanks for the fast response and fixing the default title. |
Sorry, one more thing... While this is mostly working I have also noticed that a successful call to It appears that we are waiting for confirmation from the API that the request succeeded. The So maybe this is a server-side "issue" where the file is uploaded successfully but not actually completely posted to the channel yet at the time of return and the subsequent While in general I prefer leaving things async as much as possible, in some cases (like posting a series of things to a channel) I might care about the ordering. Is there a way to cause |
@mattpr Yes, the delay is one of the key differences in the new way.
When the ordering can be critical for some of your use cases, the only workaround that I can suggest is to wait for the message with files by periodically polling Lastly, when you (or anyone else) have further feedback on the v2 method, please start a new issue dedicated to the topics. |
Hi! Tried on |
Running file uploads through GitHub actions via either https://github.com/marketplace/actions/slack-file-upload or curl results in the same issue. Going to upload to github releases and share a link in slack for now... but this is odd. A day debugging to find out the change was an internet upgrade 🤣 Not really prepared to use the new JS API for a non essential part of our CI so it would be nice if curl commands worked without a rate limit. |
Reproducible in:
The Slack SDK version
slack-sdk==3.13.0
Python runtime version
Python 3.9.10
OS info
ProductName: Mac OS X
ProductVersion: 10.15.7
BuildVersion: 19H1615
Darwin Kernel Version 19.6.0: Sun Nov 14 19:58:51 PST 2021; root:xnu-6153.141.50~1/RELEASE_X86_64
Steps to reproduce:
(Share the commands to run, source code, and project settings (e.g., setup.py))
python3 upload_to_slack.py
Expected result:
Should succeed without any error
Actual result:
The file gets uploaded but also throws this error
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: