My Amazon S3 buckets were working fine until I decided to update my aws sdk from version v2 to the modular v3.
I am able to programatically upload the file using the sdk but I am not able to upload files using the pre-signed url it generates.
const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');
const { S3Client, , PutObjectCommand } = require('@aws-sdk/client-s3');
const s3Client = S3Client({ region: 'us-east-2'});
const params = {
Bucket: '<bucket>',
Key: '1234567890.jpg',
ACL: 'private',
ContentType: 'image/jpg',
// Body: '<base64 encoded image content>'
};
const command = new PutObjectCommand(params);
// await s3Client.send(command); // works fine
const signedUrl = await getSignedUrl(s3Client, command); // generated signed url fails to upload image
When I try to make a PUT request using the presigned url generated I get a 403 HTTP error code and a message SignatureDoesNotMatch. Please guide me on what I might be missing because I've been working on this for two days now.