Skip to content

Bug: Error parsing AmazonMQ message #4051

Closed
@SZubarev

Description

@SZubarev

Expected Behaviour

AmazonMQ (ActiveMQ) message contains queue name in
...'destination': {'physicalName': 'MY.QUEUE.NAME'}... as per documentation
while parsing code is looking for
return self["destination"]["physicalname"]
which causes parsing error

Current Behaviour

Error when calling message.destination_physicalname

Code snippet

for message in event.messages:
        payload_decoded = message.decoded_data
        queue: str = message.destination_physicalname

Possible Solution

Fix typo here

Steps to Reproduce

Send message via AmazonMQ, connect lambda function as event consumer

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.11

Packaging format used

Lambda Layers

Debugging logs

[ERROR] KeyError: 'physicalname'
Traceback (most recent call last):
  File "/var/task/archive.py", line 129, in lambda_handler
    queue: str = message.destination_physicalname
  File "/opt/python/aws_lambda_powertools/utilities/data_classes/active_mq_event.py", line 62, in destination_physicalname
    return self["destination"]["physicalname"]

Metadata

Metadata

Labels

bugSomething isn't workingevent_sourcesEvent Source Data Class utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions