Repository navigation
fix(aws_s3 sink): restrict checksum calculation to fix R2 InvalidRequest - #25803
thomasqueirozb merged 5 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f20194306
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Good catch — pushed a fix. Restricted only |
c1a8c6e to
c8805ba
Compare
|
I have read the CLA Document and I hereby sign the CLA |
|
Friendly ping — open since 11 July, CLA signed and checks green. It restricts No urgency — happy to rebase or add coverage if that helps review. |
|
+1 this patch because we're now running it in production against v0.57.0. |
|
@fedora-mwinters appreciate you confirming this holds up in prod on 0.57.0 — that's good real-world signal on top of the green checks, for whenever a maintainer gets a chance to look. |
c8805ba to
d96e875
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d96e8751df
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The AWS SDK for Rust defaults to always adding an x-amz-checksum-* request checksum and validating response checksums (aws-sdk-rust#1240). Vector's S3 sink already sends its own explicit Content-MD5 header on every PutObject request, so this SDK-added checksum is redundant against AWS S3, and Cloudflare R2 rejects the combination outright with: InvalidRequest: You can only specify one non-default checksum at a time. Set request_checksum_calculation and response_checksum_validation to WhenRequired in S3ClientBuilder (shared by the aws_s3 sink and source), matching AWS's own guidance for S3-compatible endpoints. Verified with a unit test asserting the built client's config carries WhenRequired for both settings, plus cargo check/clippy/fmt and the existing aws_s3 sink/source unit test suite. Not verified against a live R2 endpoint since no R2 credentials were available; the fix follows the exact mechanism AWS documented for this incompatibility class. Generated with Claude Opus 5. Fixes vectordotdev#23029 Co-Authored-By: Claude Opus 5 <[email protected]>
…review The original fix restricted both request_checksum_calculation and response_checksum_validation to WhenRequired. Only the request side is needed: the R2 InvalidRequest failure this PR fixes is caused by an extra x-amz-checksum-* header on PutObject requests, which is a write path. response_checksum_validation only affects reads (e.g. the aws_s3 source's GetObject calls), so leaving it at WhenRequired dropped the SDK's default response integrity checking on downloads for AWS S3 with no corresponding upside. Leave response_checksum_validation at the SDK default and only restrict request_checksum_calculation.
5d5ae57 to
46d7c1f
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
Restricting optional SDK request checksums preserves Vector’s Content-MD5 header and leaves download checksum validation unchanged. The completed static review identified no actionable regression.
🤖 Bits Code Review · Commit 8233fa8
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8233fa8b4f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The S3 sink always attaches its own
Content-MD5header to everyPutObjectrequest. The AWS SDK for Rust separately defaults to calculating and attaching anx-amz-checksum-*request checksum on every request too, a behavior change described in awslabs/aws-sdk-rust#1240. Standard AWS S3 tolerates both headers at once, but Cloudflare R2 rejects the combination withInvalidRequest: You can only specify one non-default checksum at a time, which matches the debug output in this issue exactly (content-md5,x-amz-checksum-crc32, andx-amz-sdk-checksum-algorithmall present on the same request).This restricts
request_checksum_calculationtoWhenRequiredon theS3ClientBuilderused by both theaws_s3sink and source, so the SDK stops adding its own checksum on top of Vector's existingContent-MD5. This is the exact setting AWS recommends for compatibility with S3-compatible providers, so AWS S3 behavior is unaffected while R2 (and similar services) should stop seeing the conflicting headers.response_checksum_validationis left at the SDK default, since the R2 failure is on thePutObjectwrite path only, and weakening response validation would drop integrity checking onGetObjectreads for no reason.I verified this with a unit test that builds a client through
S3ClientBuilderand asserts the resulting config carriesWhenRequiredfor request checksum calculation, pluscargo check,cargo clippy, andcargo fmton the touched crate, and the existingaws_s3sink/source unit test suite (all passing). I don't have a Cloudflare R2 account, so I could not run this against a live R2 endpoint. Given the fix only removes headers the SDK adds unconditionally, and standard AWS S3 already supportsWhenRequired, I'm fairly confident in the change. A user reported running this patch in production against v0.57.0 with no issues, but a real R2 smoke test from someone who hits this issue would still be a good confirmation before merge.Fixes #23029
This PR was generated with Claude Opus 5, based on my own review of the issue thread and the S3 client construction code.