-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Aws::S3::Object::Collection#batch_delete!
raises Aws::S3::Errors::MissingContentMD5
error on minio after updating aws-sdk-s3 to 1.178.0
#3167
Comments
Aws::S3::Object::Collection#batch_delete!
raises Aws::S3::Errors::MissingContentMD5 error on minio after updating aws-sdk-s3 to 1.178.0Aws::S3::Object::Collection#batch_delete!
raises Aws::S3::Errors::MissingContentMD5
error on minio after updating aws-sdk-s3 to 1.178.0
Unfortunately this is expected behavior with a recent change by S3 and 3rd party products such as min.io #3166 |
You have a few options - option 1 - do not update s3 until min.io supports other checksum types that S3 supports such as crc32, sha256, etc. option 2 - If you want to calculate MD5 for some integrity checks, you may have to do it yourself, and pass it to APIs, or if there is no such
You can probably pre-compute md5 and pass it through context or probably insert this calculation somewhere else in the handler stack. |
@mullermp Thank you very much for your prompt response! Your comments have been very helpful. I am currently using MinIO only in the development and test environments of my Ruby on Rails project, and I am using AWS S3 in the production environment. Therefore, I plan to use a plugin that adds the Content-MD5 header only in the development and test environments, and remove the plugin when the MinIO server supports other checksums. I've created a plugin as described below and confirmed that the DeleteObjects operation works fine. class AwsS3DeleteObjectsPlugin < Seahorse::Client::Plugin
class Handler < Seahorse::Client::Handler
TARGET_OPERATION_NAME = 'DeleteObjects'.freeze
HTTP_HEADER_NAME = 'Content-Md5'.freeze
def call(context)
if context.operation.name == TARGET_OPERATION_NAME
body = context.http_request.body
context.http_request.headers[HTTP_HEADER_NAME] = calculate_md5(body)
end
@handler.call(context)
end
private
def calculate_md5(body)
Base64.encode64(OpenSSL::Digest::MD5.digest(body.string))
end
end
handler(Handler, step: :sign)
end
if Rails.env.development? || Rails.env.test?
Aws::S3::Client.add_plugin(AwsS3DeleteObjectsPlugin)
end |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Yes. One improvement is that you can pass operations to handler() instead of checking yourself.
|
@mullermp Thank you for your advice! |
Describe the bug
Hi,
I'm using minio and the aws-sdk-ruby gem.
After updating the aws-sdk-ruby gem from 1.177.0 to 1.178.0,
Aws::S3::Object::Collection#batch_delete!
raises anAws::S3::Errors::MissingContentMD5
error as below:aws-sdk-s3 1.178.0
aws-sdk-s3 1.177.0
Regression Issue
Expected Behavior
The expected behavior seems that the Aws::S3::Errors::MissingContentMD5 error is not be raised.
Current Behavior
Aws::S3::Object::Collection#batch_delete!
raises anAws::S3::Errors::MissingContentMD5
error.Reproduction Steps
Possible Solution
No response
Additional Information/Context
Upon examining the minio server logs, I discovered that the Content-Md5 HTTP header, previously sent by clients in version 1.177.0, was absent in version 1.178.0.
minio server logs
In commit df86be6, specifically the changes made to gems/aws-sdk-core/lib/aws-sdk-core/plugins/http_checksum.rb, it appears that the Content-Md5 HTTP header is no longer being added in certain conditions. Is this an intentional change?
df86be6#diff-2b60978428d604b66d702d6b0dd0580485061cac7334f236979177c4fe7659c4R14
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-s3 1.178.0
Environment details (Version of Ruby, OS environment)
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin24]
The text was updated successfully, but these errors were encountered: