Skip to content

Commit

Permalink
@uppy/companion: switch from aws-sdk v2 to @aws-sdk/3-client (v3)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbessler committed Jan 24, 2023
1 parent 6d5f678 commit 099b514
Show file tree
Hide file tree
Showing 3 changed files with 1,200 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/@uppy/companion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
],
"bin": "./bin/companion",
"dependencies": {
"@aws-sdk/client-s3": "^3.257.0",
"atob": "2.1.2",
"aws-sdk": "^2.1038.0",
"body-parser": "1.20.0",
"chalk": "4.1.2",
"common-tags": "1.8.2",
Expand Down
15 changes: 7 additions & 8 deletions packages/@uppy/companion/src/server/s3-client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const S3 = require('aws-sdk/clients/s3')
const AWS = require('aws-sdk')
const { S3Client } = require('@aws-sdk/client-s3')

/**
* instantiates the aws-sdk s3 client that will be used for s3 uploads.
Expand Down Expand Up @@ -46,13 +45,13 @@ module.exports = (companionOptions) => {
// If the user doesn't specify key and secret, the default credentials (process-env)
// will be used by S3 in calls below.
if (s3.key && s3.secret && !s3ClientOptions.credentials) {
s3ClientOptions.credentials = new AWS.Credentials(
s3.key,
s3.secret,
s3.sessionToken,
)
s3ClientOptions.credentials = {
accessKeyId: s3.key,
secretAccessKey: s3.secret,
sessionToken: s3.sessionToken,
}
}
s3Client = new S3(s3ClientOptions)
s3Client = new S3Client(s3ClientOptions)
}

return s3Client
Expand Down
Loading

0 comments on commit 099b514

Please sign in to comment.