Conversation
kuhe
approved these changes
Feb 22, 2026
…rialization When an AWS Query service (e.g. SQS) returns an HTTP 500 with an empty or malformed body, loadQueryError() returns undefined. The handleError method then crashes with "Cannot set properties of undefined" when trying to set errorData.message, which surfaces to users as a TypeError instead of a proper ServiceException. Default loadQueryError() result to an empty object so that error metadata is still populated correctly. Fixes aws#7749
e1a08fc to
36eed1d
Compare
Closed
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(core): handle empty error response body in AwsQuery protocol deserialization
Fixes #7749
Problem
When an AWS Query protocol service (e.g. SQS) returns an HTTP 500 with an empty or malformed XML body, the SDK throws a raw
TypeError: Cannot set properties of undefinedinstead of a properServiceException.The root cause is in
AwsQueryProtocol.handleError():loadQueryError(dataObject)returnsundefinedwhen the parsed body has noError,Errors, orErrors[0].Errorfields. The code then immediately tries to seterrorData.message = messageon theundefinedvalue, crashing before the error can be properly constructed.This also affects EC2 Query protocol clients since
AwsEc2QueryProtocolinheritshandleErrorfromAwsQueryProtocol.Solution
Default the return value of
loadQueryError()to an empty object (?? {}) so that property assignment and access onerrorDatasucceeds even when the response body is empty. The error is then constructed normally withType: undefined,Code: undefined, andMessage: "Unknown".Changes
packages-internal/core/src/submodules/protocols/query/AwsQueryProtocol.ts— add?? {}fallback forloadQueryError()resultpackages-internal/core/src/submodules/protocols/query/AwsQueryProtocol.spec.ts— add test for empty error response body