lift icon indicating copy to clipboard operation
lift copied to clipboard

Add optional reportBatchItemFailures setting

Open agoodno opened this issue 2 years ago • 2 comments

Start from the Use-case

When the event source mapping is created using the Lift plugin, the functionResponseType attribute is set to "ReportBatchItemFailures". For whatever reason, this causes every message sent from this trigger to fail in my Lambda function and not be processed. Manually re-creating the event source without this feature allows the message to be consumed normally by my Lambda function.

Example Config

constructs:
  my-queue:
    type: queue
...
    reportBatchItemFailures: false
    worker:
      handler: handler.handler
...

Implementation Idea

My suggestion is to allow this attribute to be added by default as it currently is, but allow a setting reportBatchItemFailures to be passed to the plugin which allows it to be turned off. My work-around is to fork this repo and remove that setting.

agoodno avatar Feb 28 '22 16:02 agoodno

For whatever reason, this causes every message sent from this trigger to fail in my Lambda function and not be processed.

Could you explain a bit more what you mean? This sounds like a bug

mnapoli avatar Feb 28 '22 16:02 mnapoli

One reason I see for this behavior is that your function returns an invalid response that lambda considers a failure.

See what is considered invalid here https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#sqs-batchfailurereporting-conditions, maybe you fall into one of those cases?

t-richard avatar Mar 01 '22 14:03 t-richard