Closed kkb0318 closed 4 months ago
Hi @kkb0318 ,
This is the expected and documented behavior:
If bucket versioning is enabled, the operation inserts a delete marker, which becomes the current version of the object. To permanently delete an object in a versioned bucket, you must include the object’s versionId in the request. For more information about versioning-enabled buckets, see Deleting object versions from a versioning-enabled bucket.
"If bucket versioning is suspended, the operation removes the object that has a null versionId, if there is one, and inserts a delete marker that becomes the current version of the object. If there isn't an object with a null versionId, and all versions of the object have a versionId, Amazon S3 does not remove the object and only inserts a delete marker."
Thanks, Ran~
This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
@RanVaknin Apologies for the delayed response, and thank you for your answers.
I now clearly understand the cause, so I will close this issue.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Acknowledgements
go get -u github.com/aws/aws-sdk-go-v2/...
)Describe the bug
When creating a new S3 bucket with ObjectLockEnabledForBucket set to true, executing DeleteObjects on any resource name ( regardless of its existence ) results in the creation of some versions in the bucket. Consequently, I am unable to delete the bucket.
Expected Behavior
I expected no versions to be created since the file was never uploaded or otherwise created in the bucket.
Current Behavior
No errors occurred when executing the DeleteObjects operation, even though the specified objects did not exist. The output from the DeleteObjects call is as follows:
the code I write below, output shows like this
Output:
Subsequent Error: When attempting to delete the bucket, an error occurred indicating that the bucket could not be deleted because it was not empty. The API error BucketNotEmpty was returned with a status code of 409, suggesting that all versions within the bucket need to be deleted first.
Reproduction Steps
The value of bucketName should be changed to a unique name before running this code to avoid conflicts.
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
Compiler and Version used
go version go1.22.2 darwin/amd64
Operating System and version
MacOS 14.4.1