Skip to content

Commit f00c06e

Browse files
committed
Handles message attribute casing differences
Updates the SQS record attributes method to handle both camelCase (AWS Lambda) and PascalCase (LocalStack/SDKs) variations in message attribute keys. This ensures compatibility across different AWS environments.
1 parent 14d8526 commit f00c06e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

acai_aws/sqs/record.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ def message_attributes(self):
2828
def attributes(self):
2929
self._attributes = self._record.get('attributes', {}).copy()
3030
for key in self.message_attributes:
31-
value = None
32-
if self.message_attributes[key].get('StringValue'):
33-
value = self.message_attributes[key]['StringValue']
34-
if self.message_attributes[key].get('BinaryValue'):
35-
value = self.message_attributes[key]['BinaryValue']
31+
attr = self.message_attributes[key]
32+
# Support both camelCase (AWS Lambda) and PascalCase (LocalStack/SDKs)
33+
value = attr.get('stringValue') or attr.get('StringValue')
34+
if not value:
35+
value = attr.get('binaryValue') or attr.get('BinaryValue')
3636
self._attributes[key] = value
3737
return self._attributes
3838

0 commit comments

Comments
 (0)