When the workflow returns to poll for messages for a second time, the event data comprises the list of messages rather than the expected initial event payload. The poll messages lambda looks for a "mailbox" key in the event - which doesn't exist and therefore fails.
{\"errorMessage\":\"'mailbox'\",\"errorType\":\"KeyError\",\"requestId\":\"760336e7-a799-43f0-b8ff-1e972a50fa73\",\"stackTrace\":[\"
File \\\"/var/task/mesh_poll_mailbox_application.py\\\", line 158, in lambda_handler\\n return app.main(event, context)\\n\",\"
File \\\"/opt/python/spine_aws_common/lambda_application.py\\\", line 74, in main\\n raise e\\n\",\"
File \\\"/opt/python/spine_aws_common/lambda_application.py\\\", line 55, in main\\n self.initialise()\\n\",\"
File \\\"/var/task/mesh_poll_mailbox_application.py\\\", line 34, in initialise\\n self.mailbox_id = self.event[\\\"mailbox\\\"]\\n\",\"
File \\\"/opt/python/aws_lambda_powertools/utilities/data_classes/common.py\\\", line 31, in __getitem__\\n return self._data[key]\\n\"]}"
}
The original event should be used as the input to the function.
When the workflow returns to poll for messages for a second time, the event data comprises the list of messages rather than the expected initial event payload. The poll messages lambda looks for a "mailbox" key in the event - which doesn't exist and therefore fails.
The original event should be used as the input to the function.