NHSDigital / terraform-aws-mesh-client

Reference implementation of a MESH Client in an AWS environment only using serverless technologies.
MIT License
1 stars 1 forks source link

get-messages lambda failure when more than 500 messages in the inbox #127

Closed davidhallam4-nhs closed 6 months ago

davidhallam4-nhs commented 6 months ago

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.