From a41c4db0c207caf62e9216b32db194aa1cbefea4 Mon Sep 17 00:00:00 2001 From: Max Wu Date: Thu, 13 May 2021 19:03:22 +0800 Subject: [PATCH] fix: S3 client config passing for image upload ref issue: https://github.com/aws/aws-sdk-js-v3/issues/1396 Signed-off-by: Max Wu --- lib/imageRouter/s3.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/imageRouter/s3.js b/lib/imageRouter/s3.js index 427c3d51e6..0d6be44ebd 100644 --- a/lib/imageRouter/s3.js +++ b/lib/imageRouter/s3.js @@ -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') {