Skip to content

Commit

Permalink
fix: S3 client config passing for image upload
Browse files Browse the repository at this point in the history
ref issue: aws/aws-sdk-js-v3#1396

Signed-off-by: Max Wu <[email protected]>
  • Loading branch information
jackycute committed May 13, 2021
1 parent 54f6e55 commit a41c4db
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/imageRouter/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ const logger = require('../logger')
const { S3Client } = require('@aws-sdk/client-s3-node/S3Client')
const { PutObjectCommand } = require('@aws-sdk/client-s3-node/commands/PutObjectCommand')

const s3 = new S3Client(config.s3)
const credentials = {
accessKeyId: config.s3.accessKeyId,
secretAccessKey: config.s3.secretAccessKey
}

const s3 = new S3Client({
credentials,
region: config.s3.region,
endpoint: config.s3.endpoint
})

exports.uploadImage = function (imagePath, callback) {
if (!imagePath || typeof imagePath !== 'string') {
Expand Down

0 comments on commit a41c4db

Please sign in to comment.