You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When returning the batchItemFailures dictionary, I think it is supposed to return a list of dictionaries. In my understanding, this is how the batchItemFailures object must look like:
While testing I noticed that the batch processor cleanup was always returning just one message ID from the batch, even when there are multiple messages that failed.
🤦 thank you so so so much @kimberlyamandalu - This is a critical bug that it's hard to believe it passed multiple reviews and our tests were naive on that too.
Changing to a list within that exp comprehension would cause the same bug, because we have a static dict key itemIdentifier - last one would win, Python would discard the rest.
When returning the
batchItemFailures
dictionary, I think it is supposed to return a list of dictionaries. In my understanding, this is how thebatchItemFailures
object must look like:I checked out the documentation here: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting
While testing I noticed that the batch processor cleanup was always returning just one message ID from the batch, even when there are multiple messages that failed.
Looks like there might be a bug in the implementation where the failed message IDs are collected.
File:
https://github.com/awslabs/aws-lambda-powertools-python/blob/develop/aws_lambda_powertools/utilities/batch/base.py
Lines:
https://github.com/awslabs/aws-lambda-powertools-python/blob/27e502298795f5720f546e09011ae7290a50a443/aws_lambda_powertools/utilities/batch/base.py#L408-L422
I think the collection methods should be returning a list.
As part of the proposed changes above, the following line also needs to be updated to avoid returning a list of list of dictionaries.
https://github.com/awslabs/aws-lambda-powertools-python/blob/27e502298795f5720f546e09011ae7290a50a443/aws_lambda_powertools/utilities/batch/base.py#L388
I have mainly been working on SQS Batch Processing for my job so I was able to test the proposed changes locally only for the SQS collection method.
Please let me know if I am mistaken or this is a valid bug.
Thank you!
The text was updated successfully, but these errors were encountered: