Skip to content

Bug: Error parsing AmazonMQ message #4051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SZubarev opened this issue Apr 1, 2024 · 3 comments · Fixed by #4053
Closed

Bug: Error parsing AmazonMQ message #4051

SZubarev opened this issue Apr 1, 2024 · 3 comments · Fixed by #4053
Assignees
Labels
bug Something isn't working event_sources Event Source Data Class utility

Comments

@SZubarev
Copy link
Contributor

SZubarev commented Apr 1, 2024

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"]
@SZubarev SZubarev added bug Something isn't working triage Pending triage from maintainers labels Apr 1, 2024
Copy link

boring-cyborg bot commented Apr 1, 2024

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@leandrodamascena
Copy link
Contributor

Hi @SZubarev! Thanks for reporting this bug! We would greatly appreciate your contribution. Would you be interested in submitting a PR to fix this?

@leandrodamascena leandrodamascena added event_sources Event Source Data Class utility and removed triage Pending triage from maintainers labels Apr 1, 2024
@leandrodamascena leandrodamascena moved this from Triage to Working on it in Powertools for AWS Lambda (Python) Apr 1, 2024
@leandrodamascena leandrodamascena self-assigned this Apr 1, 2024
SZubarev pushed a commit to SZubarev/powertools-lambda-python that referenced this issue Apr 1, 2024
leandrodamascena added a commit that referenced this issue Apr 2, 2024
…ents (#4053)

* Fix bug #4051

* Fix tests

---------

Co-authored-by: Stan Zubarev <[email protected]>
Co-authored-by: Leandro Damascena <[email protected]>
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (Python) Apr 2, 2024
Copy link
Contributor

github-actions bot commented Apr 2, 2024

⚠️COMMENT VISIBILITY 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 tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working event_sources Event Source Data Class utility
Projects
Status: Shipped
2 participants