mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(cloudformation): persist FunctionResponseTypes on Lambda::EventSourceMapping (#2964)
provisionLambdaEventSourceMapping never read the FunctionResponseTypes property, so a CFN-provisioned mapping always came back with an empty list even when the template declared it, unlike the direct CreateEventSourceMapping path. Partial batch responses were therefore ignored for CFN-deployed SQS to Lambda mappings. The property is resolved the way the arm's other array properties are, through resolveStringList, and the integration test pins the persisted value. Fixes #2848
This commit is contained in:
1 parent
8c2619f965
commit
9e2c03158d
2 files changed
+16
-1
No files matched your search
+5
@@ -4117,6 +4117,11 @@ public class CloudFormationResourceProvisioner {
|
||||
}
|
||||
}
|
||||
|
||||
List<String> functionResponseTypes = resolveStringList(props, "FunctionResponseTypes", engine);
|
||||
if (!functionResponseTypes.isEmpty()) {
|
||||
req.put("FunctionResponseTypes", functionResponseTypes);
|
||||
}
|
||||
|
||||
var esm = lambdaService.createEventSourceMapping(region, req);
|
||||
r.setPhysicalId(esm.getUuid());
|
||||
r.getAttributes().put("Id", esm.getUuid());
|
||||
|
||||
+11
-1
@@ -4403,7 +4403,8 @@ class CloudFormationIntegrationTest {
|
||||
"FunctionName": { "Ref": "MyFunction" },
|
||||
"EventSourceArn": { "Fn::GetAtt": ["MyQueue", "Arn"] },
|
||||
"Enabled": true,
|
||||
"BatchSize": 5
|
||||
"BatchSize": 5,
|
||||
"FunctionResponseTypes": ["ReportBatchItemFailures"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4457,6 +4458,15 @@ class CloudFormationIntegrationTest {
|
||||
JsonNode esmList = OBJECT_MAPPER.readTree(esmJson);
|
||||
String esmUuid = esmList.path("EventSourceMappings").get(0).path("UUID").asText();
|
||||
|
||||
// github.com/floci-io/floci/issues/2848: the CloudFormation path never read
|
||||
// FunctionResponseTypes, so a CFN-provisioned mapping always came back with an empty
|
||||
// list even though the template declared it and the direct CreateEventSourceMapping API
|
||||
// path already honored it.
|
||||
JsonNode responseTypes = esmList.path("EventSourceMappings").get(0).path("FunctionResponseTypes");
|
||||
assertTrue(responseTypes.isArray() && responseTypes.size() == 1
|
||||
&& "ReportBatchItemFailures".equals(responseTypes.get(0).asText()),
|
||||
"expected FunctionResponseTypes to carry through from the template but was: " + responseTypes);
|
||||
|
||||
// 5. Delete stack and verify ESM is gone
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
|
||||
Reference in new issue
Block a user