Merge pull request #1418 from hanicker/patch-1

Specify signatureVersion for AWS S3
This commit is contained in:
prafull-opensignlabs
2024-11-18 17:28:29 +05:30
committed by GitHub
2 changed files with 2 additions and 1 deletions
@@ -8,7 +8,7 @@ export default function getPresignedUrl(url, adapter) {
AWS.config.update({ credentials: credentials, region: adapter?.region || process.env.DO_REGION });
const spacesEndpoint = adapter?.endpoint || new AWS.Endpoint(process.env.DO_ENDPOINT);
const s3 = new AWS.S3({ endpoint: spacesEndpoint });
const s3 = new AWS.S3({ endpoint: spacesEndpoint, signatureVersion: "v4" });
// Create a new URL object
const parsedUrl = new URL(url);
@@ -14,6 +14,7 @@ async function uploadFileToS3(buffer, fileName, mimeType, adapter) {
client = new S3Client({
region: adapter?.region,
credentials: { accessKeyId: adapter?.accessKeyId, secretAccessKey: adapter?.secretAccessKey },
signatureVersion: 'v4'
});
}
const prefixId = crypto.randomBytes(16).toString('hex');