From 9e2c03158d5604af4909b9552c0254e3cd7fce78 Mon Sep 17 00:00:00 2001 From: Olamide Kosile <64154023+Mide69@users.noreply.github.com> Date: Thu, 3 Sep 2026 02:22:33 +0100 Subject: [PATCH] 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 --- .../CloudFormationResourceProvisioner.java | 5 +++++ .../CloudFormationIntegrationTest.java | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java index 6e96b236de..f157693d98 100644 --- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java +++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java @@ -4117,6 +4117,11 @@ public class CloudFormationResourceProvisioner { } } + List 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()); diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java index cff7ecced7..a1c0734c0e 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java @@ -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")