Closed brysontyrrell closed 1 year ago
@brysontyrrell Thanks for the request but it doesn't look like something CloudFormation supports at this time. Until that is released, SAM can't do anything: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html
@jfuss It looks like it is in CloudFormation:
AWS::Lambda::EventSourceMapping
FunctionResponseTypes
(Streams and SQS) A list of current response type enums applied to the event source mapping.
Valid Values: ReportBatchItemFailures
Required: No
Type: List of String
Maximum: 1
Update requires: No interruption
Function response types has already been exposed for the DynamoDB event source in SAM:
For anyone else looking at this for answers, here's a functional sample template that works (bonus points if you use Python with Lambda): https://awslabs.github.io/aws-lambda-powertools-python/latest/utilities/batch/#required-resources
Sorry just getting back from parental leave.
@brysontyrrell I was looking at Permissions not Event Source Mappings 🤦
@heitorlessa and @brysontyrrell So then it looks like we support this already? Seems like the case quickly looking through code but our docs don't suggest it. I assume @heitorlessa tested that Powertools example. 🤔
@jfuss @heitorlessa - Hey guys. Any word on updating the documentation to reflect that this is in SAM and supported?
This still doesn't show that FunctionResponseTypes
is a supported attribute:
BatchSize: Integer
Enabled: Boolean
FilterCriteria: FilterCriteria
MaximumBatchingWindowInSeconds: Integer
Queue: String
@brysontyrrell Looking at the commit: https://github.com/aws/serverless-application-model/pull/1883 it only mentions support for Kinesis and DynamoDB Streams. Maybe SQS came later?
Anyways, let me kick off an internal issue to get this added to SQS. Updating labels as well.
What's the status on this issue? This seems to still be an issue and the ticket's approaching it's 1 year mark...
Reproducable example for posterity:
Transform: AWS::Serverless-2016-10-31
Resources:
MyQueue:
Type: AWS::SQS::Queue
MyFunction:
Type: AWS::Serverless::Function
Properties:
InlineCode: foo
Handler: bar
Runtime: python3.9
Events:
SQSEvent:
Type: SQS
Properties:
Queue: !GetAtt MyQueue.Arn
FunctionResponseTypes:
- ReportBatchItemFailures
Deploy with:
sam deploy --region us-west-2 --resolve-s3 --capabilities CAPABILITY_IAM --stack-name test-2515 --template template.yaml
Describe your idea/feature/enhancement
The SQS event source for Lambda supports reporting failed messages within a batch: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting
Example response:
The SQS event source created by SAM does not enable this option. This has great benefit when enabled so we can report back messages that failed without forcing the entire batch to be retried.
Here is an example event source created by SAM:
Here is the same event source created manually and setting ReportBatchItemFailures:
Proposal
Add an additional property onto SQS event configurations to allow enabling features like ReportBatchItemFailures.
Things to consider: [ ] The SAM documentation will need to be updated