-
Notifications
You must be signed in to change notification settings - Fork 593
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
@aws-sdk/client-s3 RequestTimeout error in PutObjectCommand #6762
Comments
@somnathPrasad I was recently bit by this too. Apparently the default socketTimeout is not sufficient since network traffic or when S3 is busy a RequestTimeout can occur. In our testing, the default SDK client timeout is less then 72s and can easily cause the RequestTimeout. To fix this you simply need to increase the socketTimeout in the S3 client. For example adding it to your code is as follows: const s3Client = new S3Client({
credentials: { accessKeyId, secretAccessKey },
region,
requestHandler: {
socketTimeout: 5 * 60 * 1000 // ms (increase to 5m or other appropriate value)
}
});
... For reference see these links:
I am in the process of writing up an issue for the team to hopefully improve the examples and docs to help prevent this issue for others. When it is ready, I will link to this issue as well for reference. |
Thank you so much! @jeffbski-rga I was recently migrating from v2 to v3 for one of our older projects and encountered this issue. You are right; the error message it throws is not sufficient at all. |
closing this issue now |
@somnathPrasad AWS SDK team informed me that we should use requestTimeout rather than socketTimeout. socketTimeout is deprecated. #6763 (comment) So the new code would be like: const s3Client = new S3Client({
credentials: { accessKeyId, secretAccessKey },
region,
requestHandler: {
requestTimeout: 5 * 60 * 1000 // ms (increase to 5m or other appropriate value)
}
});
... |
okay, it makes more sense. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Checkboxes for prior research
Describe the bug
I am trying to upload an image file to a public s3 bucket. But every time I get this error, even when trying to upload a very small file (eg: 130kb)
RequestTimeout: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
This is the code block
But this is working in the old aws package "aws-sdk": "^2.962.0"
Regression Issue
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.17.0
Reproduction Steps
The same bug can be reproduced through the above code.
Observed Behavior
I am getting this error.
Expected Behavior
I expected it to upload file to s3 and not give any errors
Possible Solution
No response
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: