aws javascript sdk v3 - signature mismatch error #14709
-
I can generate the presigned url following the steps as described in this section, so I wanted to test uploading a specific image marble.jpg and I tried to use postman to test the upload. So, I copied the presigned url and hit the endpoint with a PUT request, and I got this error:
The following resources are setup:
The only thing I haven't tried is to add the signatureVersion like one would in sdk version prior to 3:
but, using javascript sdk for s3 version 3 this is not available while constructing the s3 client. So, The question is:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 11 replies
-
I'm encountering the same issue. According to https://github.com/aws/aws-sdk-js-v3/blob/main/UPGRADING.md v3 only supports signature v4, but apparently there's something different it does from the v2 SDK, because that one actually works with Minio. Is there a special setting in Minio that needs to be changed for this to be compatible? |
Beta Was this translation helpful? Give feedback.
-
@beez-dev please capture |
Beta Was this translation helpful? Give feedback.
-
Comparing the two generated urls side by side, I can see something extra in
Is this something that can be adjusted or something will have to be fixed from |
Beta Was this translation helpful? Give feedback.
-
This is a stupid regression in aws-sdk-js-v3 @beez-dev they ignore the port passed to the endpoint as part of signature calculation
Here is the canonical request generated by the client
As a workaround start the server at port "80" for now - ask upstream to fix their bugs @beez-dev import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
const s3Client = new S3Client({
region: 'us-east-1',
credentials: {
accessKeyId: 'minioadmin',
secretAccessKey: 'minioadmin',
},
endpoint: "http://localhost",
forcePathStyle: true,
});
const bucketParams = {
Bucket: 'myBucket',
Key: `marbles.jpg`,
};
const command = new PutObjectCommand(bucketParams);
(async function () {
try {
const signedUrl = await getSignedUrl(s3Client, command, {
expiresIn: 10000,
})
console.log(signedUrl)
} catch (err) {
console.error(err)
}
})(); This works perfectly fine. |
Beta Was this translation helpful? Give feedback.
This is a stupid regression in aws-sdk-js-v3 @beez-dev they ignore the port passed to the endpoint as part of signature calculation