Open huangyongfa opened 1 week ago
import { S3Client, CreateMultipartUploadCommand, UploadPartCommand, CompleteMultipartUploadCommand, AbortMultipartUploadCommand } from '@aws-sdk/client-s3'
import { FetchHttpHandler } from '@smithy/fetch-http-handler'
this.s3 = new S3Client({
region: 'ap-southeast-1',
credentials: {
accessKeyId: this.awsdk.accessKeyId,
secretAccessKey: this.awsdk.accessKeySecret,
sessionToken: this.awsdk.securityToken
},
httpHandler: new FetchHttpHandler({
keepAlive: true,
requestTimeout: 60000
})
})
Is there an error in the writing of htpHandler? Causing keepAlive to not take effect?
this.s3 = new S3Client({
.......
requestHandler: new FetchHttpHandler({
keepAlive: true,
requestTimeout: 6000
})
})
The use of requestHandler in S3Client will cause the call to the AWS method, CreatMultipartUploadCommand, to fail
Hi @huangyongfa - apologies for delay.
I wasn't able to reproduce with version @aws-sdk/client-s3@3.427.0
. Have you tried the workaround suggested in the issue you mentioned?
To resolve this issue, explicitly set keepAlive=false as in my previous example or ensure that your application has @smithy/fetch-http-handler@2.2.3 installed.
You may need to update your lockfile for this, since fetch-http-handler is a transitive dependency of the SDK. You do not need to explicitly install it in your package.json.
import { FetchHttpHandler } from "@smithy/fetch-http-handler";
import { S3Client } from "@aws-sdk/client-s3";
new S3Client({
requestHandler: new FetchHttpHandler({ keepAlive: false })
});
Please try to explicitly set keepAlive: false
, make sure latest version of @smithy/fetch-http-handler
installed.
Checkboxes for prior research
Describe the bug
I use @aws-sdk/client-s3 + @smithy/fetch-http-handler to upload a large 1.8G file, and realize the slice upload and resumable upload functions,
I refer to these articles:
https://github.com/aws/aws-sdk-js-v3/issues/5334 https://stackoverflow.com/questions/77229817/failed-to-fetch-aws
The aws-sdk version has been modified, but this error still appears in the upload: Failed to fetch。
I did the sessionToken timeout to re-obtain the logic, when uploading to a shard in the middle, it appeared that the shard could not be connected, can you help analyze what is going on?
SDK version number
@aws-sdk/client-s3@3.427.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v16.14.2
Reproduction Steps
Here's my demo code
Observed Behavior
as shown in the picture when it was uploaded to the 8th shard, it could not be connected after trying to reconnect, and then it could not be connected when it was 17 shards
Expected Behavior
It just thawed error.
Possible Solution
It should work perfectly!
Additional Information/Context
No response