-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError for getBucketLifecycleConfiguration() in aws-sdk/client-s3 #3585
Comments
Hi @ardenercelik, thank you for reaching out. I was able to reproduce the reported behavior and the reason why this happens is because one of the internal validation of the SDK is expecting that one of the fields from the response, either, or not to be present or that the value be an object, but an empty string is being received instead. Please see below: {
ID: 'autodeletion',
Filter: '', // This is the field that causes the problem
Status: 'Enabled',
Expiration: { ExpiredObjectDeleteMarker: 'true' },
NoncurrentVersionExpiration: { NoncurrentDays: '1', NewerNoncurrentVersions: '1' },
AbortIncompleteMultipartUpload: { DaysAfterInitiation: '1' }
} if (output["Filter"] !== undefined) {
// Here when we pass the field Filter the function generates an exception if the field value is not an object
contents.Filter = deserializeAws_restXmlLifecycleRuleFilter(__expectUnion(output["Filter"]), context);
} // With the following conditions we make sure that "Filter" is defined and is not an empty string
if (output["Filter"] !== undefined && output["Filter"] !== '') {
contents.Filter = deserializeAws_restXmlLifecycleRuleFilter(__expectUnion(output["Filter"]), context);
} The validation is done in the following ts file:
I will mark this issue to review so one of our developers take a look to it. Thank you! |
@AllanZhengYP here is the body: Body: {
xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
Rule: {
ID: 'autodeletion',
Filter: '',
Status: 'Enabled',
Expiration: { ExpiredObjectDeleteMarker: 'true' },
NoncurrentVersionExpiration: { NoncurrentDays: '1', NewerNoncurrentVersions: '1' },
AbortIncompleteMultipartUpload: { DaysAfterInitiation: '1' }
}
} |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
Although I am using the getBucketLifecycleConfiguration correctly, I am getting a internal TypeError in aws-sdk/client-s3. The operation is working as expected when using boto3 or aws cli tool like below
$ aws s3api get-bucket-lifecycle-configuration --bucket name-of-our-s3-bucket
Is the issue in the browser/Node.js?
Node.js
If on Node.js, are you running this on AWS Lambda?
No
Details of the browser/Node.js version
v16.13.2
SDK version number
"@aws-sdk/client-s3": "^3.67.0"
To Reproduce (observed behavior)
I saw this behaviour in our 3 s3 buckets total
Expected behavior
To dump Lifecycle configuration for the specified bucket.
The text was updated successfully, but these errors were encountered: