Skip to content

fix(app): inflate gzip-compressed request bodies - #1513

Open
Lukasdoe wants to merge 1 commit into
ministackorg:mainfrom
Lukasdoe:fix/gzip-request-body
Open

fix(app): inflate gzip-compressed request bodies#1513
Lukasdoe wants to merge 1 commit into
ministackorg:mainfrom
Lukasdoe:fix/gzip-request-body

Conversation

@Lukasdoe

Copy link
Copy Markdown
Contributor

AWS SDKs gzip request bodies above ~10 KB for operations carrying smithy's @requestCompression trait (Lambda CreateFunction, CloudWatch Logs, EC2) and send Content-Encoding: gzip. The aws-chunked decoder strips the chunk framing but leaves the gzip layer, so handlers parse compressed bytes and fail with SerializationException (Lambda, Logs) or InvalidAction (EC2, where the gzipped form body hides the Action parameter).

Inflate the body once the target service is known and drop the gzip token from Content-Encoding. S3 is excluded: Content-Encoding is object metadata there, so the stored bytes must stay exactly as sent.

@github-actions

Copy link
Copy Markdown

Docker image for this PR has been published: ministackorg/ministack-preview-build:pr-1513-0b1b18e4

@Nahuel990

Copy link
Copy Markdown
Collaborator

@Lukasdoe Do you have a repro script for this? I don't have any source to back this PR

@Lukasdoe
Lukasdoe force-pushed the fix/gzip-request-body branch from 0b1b18e to a48e2b2 Compare August 26, 2026 13:22
@github-actions

Copy link
Copy Markdown

Docker image for this PR has been published: ministackorg/ministack-preview-build:pr-1513-a48e2b21

Smithy's @requestCompression trait makes an AWS SDK gzip a request body once it
passes REQUEST_MIN_COMPRESSION_SIZE_BYTES (default 10240) and send
Content-Encoding: gzip. CloudWatch PutMetricData carries the trait in botocore's
and aws-sdk-go-v2's bundled models, so boto3 compresses it with no client
configuration at all.

The aws-chunked decoder strips the chunk framing but leaves the gzip layer, so
the handler parses compressed bytes. A PutMetricData call above 10 KB answered
200 and stored none of the batch: the caller lost every datapoint with no error
to see.

Inflate the body once the target service is known and drop the gzip token from
Content-Encoding. S3 is excluded: Content-Encoding is object metadata there, so
the stored bytes must stay exactly as sent, which the existing S3 encoding test
pins.

Tests cover the operation an SDK really compresses (boto3 PutMetricData,
asserting the request was gzipped so the test cannot silently stop covering the
bug), the JSON and Query wire paths with hand-built gzip bodies, and an S3
passthrough guard.
@Lukasdoe
Lukasdoe force-pushed the fix/gzip-request-body branch from a48e2b2 to ea728c4 Compare August 26, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants