sam: cdk synth is missing prop for CfnFunction
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Description:
I am trying to setup an SQS event handler with ReportBatchItemFailures enabled. I am using CDK. However, the option will still be disabled.
### Steps to reproduce:
I am using this in CDK template:
```
new sam.CfnFunction(this, 'some-function', {
events: {
sqs: {
type: 'SQS',
properties: {
queue: this.queue.queueArn,
batchSize: 10,
functionResponseTypes: [ 'ReportBatchItemFailures' ],
}
}
}
});
```
### Observed result:
The function response types are not inserted into the generated template:
```
somefunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: somefunction
Events:
sqs:
Properties:
BatchSize: 10
Queue:
Fn::GetAtt:
- somequeue
- Arn
Type: SQS
```
### Expected result:
I expect the ReportBatchItemFailures to be injected into the generated template:
```
Properties:
BatchSize: 10
Queue:
Fn::GetAtt:
- somequeue
- Arn
FunctionResponseTypes:
- ReportBatchItemFailures
```
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: Windows
2. `sam --version`:
3. AWS region: eu-west-1
```
{
"version": "1.109.0",
"system": {
"python": "3.11.7",
"os": "Windows-10-10.0.22631-SP0"
},
"additional_dependencies": {
"docker_engine": "Not available",
"aws_cdk": "Not available",
"terraform": "1.7.3"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
```
`Add --debug flag to command you are running`
Contributor guide
Research direction
Start with the TypeScript definition of sam.CfnFunction and the cdk synth path that serializes its SQS event properties. Compare the reproduced input with the generated template, then verify completion when FunctionResponseTypes is emitted and the behavior has regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100