DDBClient with Gzip enabled occasionally fails to decompress error responses #2938
Closed
2 of 3 tasks
Labels
bug
This issue is a bug.
closed-for-staleness
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Acknowledgements
go get -u github.com/aws/aws-sdk-go-v2/...
)Describe the bug
We construct a client with
EnableAcceptEncodingGzip = true
and have occasionally been getting the following error:"gzip: invalid header" comes from the gzip library when the headers are invalid/unexpected.
The "failed to decompress gzip response" string comes from this part of the SDK.
This pretty clearly indicates a mismatch between what the server is sending and how the SDK is attempting to parse the value. E.g. perhaps the server is sometimes responding without gzipping the response even though the SDK is always expecting it? maybe particular errors / small errors just don't get zipped by default?
Regression Issue
Expected Behavior
I expected the SDK to be able to parse the response received from AWS/DDB regardless when accepting Gzip encoded data.
Current Behavior
Sometimes the gzip headers from AWS/DDB are invalid (most likely missing), and the SDK cannot handle the response because it unconditionally expects gzip encoding when
EnableAcceptEncodingGzip
is set to true.Reproduction Steps
Unfortunately I do not know how to reliably reproduce this. I'm not sure when AWS/DDB might not be sending valid gzip headers. However, you must set
EnableAcceptEncodingGzip to true
.Possible Solution
gzip.ErrHeader
and just read the bytes directly as non-compressed data.Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
Compiler and Version used
go1.23.1 darwin/arm64
Operating System and version
macOS 15.1.1
The text was updated successfully, but these errors were encountered: