cloudydeno / deno-aws_api

From-scratch Typescript client for accessing AWS APIs
https://deno.land/x/aws_api
59 stars 3 forks source link

fix(s3): add Content-MD5 header to deleteObjects request #27

Closed TillaTheHun0 closed 2 years ago

TillaTheHun0 commented 2 years ago

Thanks for this SDK!

I was attempting to use the s3.deleteObjects api and was receiving an error:

InvalidRequest: Missing required header for this request: Content-MD5

This header is required for deleteObjects requests:

Finally, the Content-MD5 header is required for all Multi-Object Delete requests. Amazon S3 uses the header value to ensure that your request body has not been altered in transit.

This PR adds that header to the s3.deleteObjects request.

danopia commented 2 years ago

Hey, Thanks for the report and PR! I hope you were able to achieve what you were originally trying to do with this library. Unfortunately the service API files are generated (from aws-sdk definitions) and I'll need to figure out why the header wasn't present to begin with before I can merge this. I'll check that out this weekend. Happy Friday 😃

TillaTheHun0 commented 2 years ago

Thanks @danopia .

Ah I see. I wasn't sure what was generated in the lib. In the meantime, I've just been running off my fork, with the header included. That resolved my issue, so no rush.

Hope it helps and have a good weekend!

danopia commented 2 years ago

Ok, it's related to a schema field I wasn't using. This hasn't come up before because most S3 operations include Content-MD5 explicitly. So I added a 'quirks' case to insert the field as needed.

Looks like there are 2 affected S3 APIs: DeleteObjects and PutBucketLifecycleConfiguration (both having red boxes on their docs about the requirement). And then also most s3control APIs.

I'll merge this to get the codegen server updated, and that will also trigger a resync of the generated files in git. Thanks again for reporting the broken API.