Skip to content

Commit

Permalink
AWS SDK bug - need to provide our own fetch handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanto committed Oct 10, 2023
1 parent 4391c7c commit e80d1e5
Show file tree
Hide file tree
Showing 3 changed files with 625 additions and 502 deletions.
9 changes: 5 additions & 4 deletions packages/next-s3-upload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@
"typescript": "^4.2.3"
},
"dependencies": {
"@aws-sdk/client-s3": ">=3.388.0",
"@aws-sdk/client-sts": "^3.388.0",
"@aws-sdk/lib-storage": ">=3.388.0",
"@aws-sdk/s3-request-presigner": "^3.388.0",
"@aws-sdk/client-s3": ">=3.427.0",
"@aws-sdk/client-sts": "^3.427.0",
"@aws-sdk/lib-storage": ">=3.427.0",
"@aws-sdk/s3-request-presigner": "^3.427.0",
"@smithy/fetch-http-handler": "^2.2.2",
"uuid": "^8.3.1"
}
}
2 changes: 2 additions & 0 deletions packages/next-s3-upload/src/hooks/use-s3-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from '@aws-sdk/client-s3';
import { Upload } from '@aws-sdk/lib-storage';
import { Uploader, useUploader } from './use-uploader';
import { FetchHttpHandler } from '@smithy/fetch-http-handler';

type Params = {
key: string;
Expand All @@ -16,6 +17,7 @@ let upload: Uploader<Params> = async (file, params, { onProgress }) => {
let { key, bucket, token, region } = params;

let client = new S3Client({
requestHandler: new FetchHttpHandler({ keepAlive: false }),
credentials: {
accessKeyId: token.Credentials.AccessKeyId,
secretAccessKey: token.Credentials.SecretAccessKey,
Expand Down
Loading

0 comments on commit e80d1e5

Please sign in to comment.