Skip to content

Commit 599fd41

Browse files
authored
Merge pull request #1683 from hackmdio/bugfix/fix-image-upload-s3-config
Fix S3 client config passing for image upload
2 parents 54f6e55 + a41c4db commit 599fd41

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/imageRouter/s3.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ const logger = require('../logger')
99
const { S3Client } = require('@aws-sdk/client-s3-node/S3Client')
1010
const { PutObjectCommand } = require('@aws-sdk/client-s3-node/commands/PutObjectCommand')
1111

12-
const s3 = new S3Client(config.s3)
12+
const credentials = {
13+
accessKeyId: config.s3.accessKeyId,
14+
secretAccessKey: config.s3.secretAccessKey
15+
}
16+
17+
const s3 = new S3Client({
18+
credentials,
19+
region: config.s3.region,
20+
endpoint: config.s3.endpoint
21+
})
1322

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

0 commit comments

Comments
 (0)