S3 ListObjectVersions ObjectVersionStorageClass type is incorrect
Checkboxes for prior research
- [X] I've gone through Developer Guide and API reference
- [X] I've checked AWS Forums and StackOverflow.
- [X] I've searched for previous similar issues and didn't find any solution.
Describe the bug
the type of ObjectVersionStorageClass in the result output of ListObjectVersionsOutput.Versions[].StorageClass is allowing only "STANDARD", it should allow all possible storage class.
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.11.0
Reproduction Steps
Request ListObjectVersionsCommand
example:
const VS = await s3ClientApSoutheast1.send(
new ListObjectVersionsCommand({
Bucket: 'bucket-name',
}),
);
Observed Behavior
Versions[].StorageClass type is fixed to "STANDARD"
Expected Behavior
Versions[].StorageClass type should allow any valid storage class
Possible Solution
No response
Additional Information/Context
No response
According to this service documentation, I only see STANDARD available: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ObjectVersion.html.
If DEEP_ARCHIVE is indeed available, we have to wait for the service to push the model update to the SDKs.
Ahh I see that's a bug in the services documentation, what are the steps to move this there?
Hi @rawpixel-vincent - you can directly reach out to service team via AWS Support or we can submit a request to service team on your behalf. Let us know if you'd like us to submit a request.
Hi, it's great if you don't mind forwarding this request on my behalf. Thank you
Submitted a request to service team, and transferred the issue to our cross-SDK repo, please check back in for updates. (ref:P120170678)
Hi, it's been a while, just hit the same issue today, any chances to get this resolved ?
confirmed again all storage class can be seen.
let classViewed = new Set();
while (true) {
const VS = await s3Client.send(
new ListObjectVersionsCommand({
Prefix: prefix,
Bucket: '*****',
MaxKeys: 1000,
KeyMarker: nextKeyMarker,
}),
);
if (!VS?.Versions?.length) {
break;
}
nextKeyMarker = VS.IsTruncated ? VS.NextKeyMarker : null;
for (const v of VS.Versions) {
if (!classViewed.has(v.StorageClass)) {
console.log(
`Class:${v.StorageClass}, Version:${v.VersionId}, Key:${v.Key}`,
);
classViewed.add(v.StorageClass);
}
if (classViewed.size > 2) {
return;
}
}
Class:STANDARD, Version:nhvqjDv__1qS*****FhjxZje70, Key:**2*-**/rm*6*-***dboa*de*-0**zip
Class:STANDARD_IA, Version:9y33U******FpITV17E6pL, Key:2*22-****m558*e**m*n*-r**r*computer*m**kup**ip
Class:INTELLIGENT_TIERING, Version:****UBd, Key:2*2*-12/p*20*2***60-***m*02**-0*-*ob1*6**v-**.e*s
Workaround
/**
* @typedef {Omit<import('@aws-sdk/client-s3').ListObjectVersionsOutput, 'Versions'> & {Versions: (Omit<import('@aws-sdk/client-s3').ObjectVersion, 'StorageClass'> & {StorageClass: import('@aws-sdk/client-s3').StorageClass})[]}} ListObjectVersionsOutputWithStorageClass
*/
const VS = /** @type {ListObjectVersionsOutputWithStorageClass} */ (
await s3Client.send(
new ListObjectVersionsCommand({
Prefix: prefix,
Bucket: bucket,
MaxKeys: 1000,
KeyMarker: nextKeyMarker,
}),
)
);
No updates from service team, so far. I had just checked in for updates.