chalice icon indicating copy to clipboard operation
chalice copied to clipboard

Support of Return Batch Failure Item for SQS

Open rgravelintelcom opened this issue 2 years ago • 3 comments

Hi, We are using Chalice and Terraform to deploy our application. We would like to use the the Return Batch Failure Item for message that fail during the process of an SQS event. Actually, it work if we manually mark the checkbox in the Lambda SQS Trigger in the console and return the return {"batchItemFailures": {"itemIdentifier": record._event_dict.get('messageId')}}. But since we are all automated and trying to avoid manual configuration, is there a plan to add the support of it in the @app.on_sqs_message parameters? Or is there any way to automate it in other way but still using the annotation? Thanks

rgravelintelcom avatar Mar 17 '23 20:03 rgravelintelcom

I am looking for ways to enable this option via IaC as well

dorukhan-ti avatar Mar 29 '23 17:03 dorukhan-ti

I am looking for ways to enable this option via IaC as well

I have automated this for our deployment environment like so:

  • Add the ARN of SQS as CfnOutput
  • Use aws cloudformation describe-stacks to extract the outputs
  • Use aws lambda list-event-source-mappings to get the mappings for this SQS
  • Use aws lambda update-event-source-mapping to update the config

dorukhan-ti avatar Apr 07 '23 01:04 dorukhan-ti

Our CI/CD pipeline is using Terraform. Here is a workaround for automatic deployment in such case: https://github.com/aws/chalice/issues/2031#issuecomment-1900711686

Ecitperbo avatar Jan 19 '24 16:01 Ecitperbo