aws-sdk-js-v3
aws-sdk-js-v3 copied to clipboard
Bring back the location value of a newly created S3 object to V3 like it was in V2
Is your feature request related to a problem? Please describe.
When using the V2 integration, I used to receive an object containing the Location
attribute with the URL of the newly created resource. This is a breaking change affecting backwards compatibility. Once I received that value, I just updated the DB with the new URL value or sent it to the UI when appropriate. The object used to look like this:
{
ETag: '"0146857b12974c330421e3c56e9exxxx"',
Location: 'https://xxxxxx.s3.ap-southeast-2.amazonaws.com/clubLogos/9401bcd7-cccf-456c-a6f4-ba9cfd44b49b.webp',
key: 'clubLogos/9401bcd7-cccf-456c-a6f4-ba9cfd44b49b.webp',
Key: 'clubLogos/9401bcd7-cccf-456c-a6f4-ba9cfd44b49b.webp',
Bucket: xxxxxx'
}
Describe the solution you'd like
A clear and concise description of what you want to happen.
For the API call const results = await s3Client.send(new PutObjectCommand(params));
I would like the returned object params to contain the Location attribute like:
{
Bucket: 'xxxxxx',
Key: 'clubLogos/9401bcd7-cccf-456c-a6f4-ba9cfd44b49b.webp',
Location: 'https://xxxxxx.s3.ap-southeast-2.amazonaws.com/clubLogos/9401bcd7-cccf-456c-a6f4-ba9cfd44b49b.webp',
Body: <Buffer 52 49 46 46 04 0b 00 00 57 45 42 50 56 50 38 20 f8 0a 00 00 10 44 00 9d 01 2a c8 00 71 00 3e 6d 2e 94 46 a4 22 a2 21 2d 33 5b 88 80 0d 89 65 00 c5 48 ... 2778 more bytes>,
ACL: 'public-read'
}
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
You could also add the BaseUrl
parameter to the returned params
object like:
{
Bucket: 'xxxxxx',
Key: 'clubLogos/9401bcd7-cccf-456c-a6f4-ba9cfd44b49b.webp',
BaseUrl: 'https://xxxxxx.s3.ap-southeast-2.amazonaws.com',
Body: <Buffer 52 49 46 46 04 0b 00 00 57 45 42 50 56 50 38 20 f8 0a 00 00 10 44 00 9d 01 2a c8 00 71 00 3e 6d 2e 94 46 a4 22 a2 21 2d 33 5b 88 80 0d 89 65 00 c5 48 ... 2778 more bytes>,
ACL: 'public-read'
}
In this case, users would not have to store the base URL for each bucket to be appended to the Key value.
Additional context
Add any other context or screenshots about the feature request here.
I was also using this functionality, now I'm stuck with manually building the URL unfortunately.
Same here.
same
please bring this back