aws-sdk-js: RequestTimeout: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
I’m getting this error once in a while when making a putObject
call.
What is the root cause of the error and what’s the best way to avoid it?
According to API response looks like this error is non-retryable. Is there a way to configure aws-sdk
to make a retry when this type of error happens?
example response: {“message”:“Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.”,“code”:“RequestTimeout”,“time”:“2014-05-21T00:50:25.709Z”,“statusCode”:400,“retryable”:false,“_willRetry”:false}
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 29 (5 by maintainers)
Commits related to this issue
- Tag release v2.0.0 References: #281, #298, #302, #303, aws/aws-sdk-js-apis#2, joyent/node#6829, joyent/node#7031 — committed to aws/aws-sdk-js by lsegal 10 years ago
Now I have pinned point the issue on
2.68.0
<=2.67.0
have no problems.Further investigation:
The release change on
2.68.0
is:Setting
signatureVersion
tov2
solve this problem:const s3 = new AWS.S3({signatureVersion: 'v2'});
The followings don’t work:
const s3 = new AWS.S3();
=>RequestTimeout: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
const s3 = new AWS.S3({signatureVersion:'v4');
=>RequestTimeout: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
const s3 = new AWS.S3({signatureVersion:'v3');
=>AccessDenied: Access Denied
I don’t have time to debug this, but I got the error as well. I uploaded a file from a website to my server (Node) using Ajax, and then uploaded it from my serverto S3 with code looking like this:
The funny thing is that it always fails for the first Ajax request I send, but it works for all that comes after. I don’t know if this is a bug in the AWS SDK or the package
multer
(with express) I use to receive the uploaded file on my server (although I receive the file perfectly well as far as I can tell; it’s saved on my server).However, when I change my code to:
It works for all my Ajax request.
I might have done a mistake somewhere (I’m not an experience Node programmer), but hopefully this will help someone.
Anybody fixed this?
It’s quite unbelievable that such commonly used features are faulty after so many years!!! 👎
Is there any work around?
I can only use putObject as the upload method upload 0 byte files (corrupt)
But putObject timeouts if the file is larger then 100 kb.
Is this useless?
Just use
s3.upload
instead ofs3.putObject
method. 😉@paulduthoit Worked! Thanks!
Have the same issue, But when i try signature v2: I get:
The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256
@jeskew, there shouldn’t be any need for a retry if it would work as it should, right? Something is wrong and needs to be fixed? Or am I missing something?
I use a stream to upload a war file to s3 and set the content length with the file size. On slow internet connections (1 Mbps upload) I get this error:
I am using version 2.1.33 so the workaround doesn’t work for me.
@lsegal Could you explain me a fix for a stream?