You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: SQSMessageAttribute.binary_value raises KeyError for String attributes #8712
SQSMessageAttribute.string_value and binary_value are typed str | None, so reading the value an attribute doesn't carry should return None.
Current Behaviour
Both properties index the dict directly (self["stringValue"], self["binaryValue"]). Lambda only sends the field that matches the attribute's type; the SQS example event in the Lambda docs has {"stringValue": "myValue", "stringListValues": [], "binaryListValues": [], "dataType": "String"} with no binaryValue. So binary_value on any String or Number attribute, and string_value on any Binary attribute, raise KeyError.
The test event tests/events/sqsEvent.json puts both stringValue and binaryValue on one attribute, which is why the existing tests don't hit this. The Pydantic SqsMsgAttributeModel already declares both fields optional.
Thanks @anishmehta24, confirmed. Lambda only sends the field matching the attribute type, our fixture has both on the same attribute, so the tests never caught it. I'll review #8713. Goes into 3.40.0.
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
leandrodamascena commentedon Oct 30, 2026
Thanks @anishmehta24, confirmed. Lambda only sends the field matching the attribute type, our fixture has both on the same attribute, so the tests never caught it. I'll review #8713. Goes into 3.40.0.
leandrodamascena commentedon Nov 4, 2026
Fixed by #8713, merged as 8074a54.
powertools-for-aws-oss-automation commentedon Nov 4, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Nov 10, 2026
This is now released under 3.40.0 version!