I have an SQS queue with a lambda consumer. I have...
# sst
j
I have an SQS queue with a lambda consumer. I have
reportBatchItemFailures
set to true, and my return from the lambda is
Copy code
{
  batchItemFailures: [ { itemIdentifier: 'd6d84d1b-a232-46f8-822d-bc4b232c5a45' } ]
}
So I would expect it to be retried after the visibility timeout, not deleted. But it's not being retried, and when I check the monitoring tab it shows that the message was deleted. Queue definition:
Copy code
new sst.Queue(this, 'name', {
      sqsQueue: {
        retentionPeriod: Duration.days(14),
        visibilityTimeout: Duration.seconds(30), 
        deadLetterQueue: {
          queue: deadLetterQueue.sqsQueue,
          maxReceiveCount: 8,
        },
      },
      consumer: {
        deadLetterQueueEnabled: true,
        handler: 'src/services/svc.handler',
        timeout: 5,
        memorySize: 8192,
        consumerProps: { reportBatchItemFailures: true, batchSize: 5 },
       
      },
    });
Handler:
Copy code
export const handler = async (event: SQSEvent) => {
  const failedIds = await run(event);
  const response = {
    batchItemFailures: failedIds.map((id) => {
      return {
        itemIdentifier: id,
      };
    }),
  };
  console.log('Response: ', response);
  return response;
};
Anything I could be missing?
It seems like this is an sst bug? When I change the stack above to use a full function definition instead of just using the
handler
property, it works. I would've never noticed this but another one of our consumers happened to be defined in that way and was working as expected. When using
{consumer: {handler: "handlerpath"}
the cloudformation template does not populate the functionResponseType in the event source mapping