fix(aws-lambda): route an omitted PlanProtocol before comparing it (#6985)

Step Functions raises States.Runtime for a StringEquals on a missing path
instead of treating it as a non-match, so a state machine input without
PlanProtocol failed at SelectPlanProtocol and never reached the Default
branch. Check presence first in both the SAM template and the CDK stack.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
James Russo
2026-11-02 06:37:39 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent f1391156e0
commit 758759673b
3 changed files with 28 additions and 0 deletions
@@ -443,7 +443,10 @@ export class HyperframesRenderStack extends Construct {
error: "PLAN_PROTOCOL_UNSUPPORTED",
cause: 'PlanProtocol must be "v2" or absent (defaults to v2).',
});
// A comparison on a missing path is a States.Runtime error, not a non-match, so an omitted
// PlanProtocol has to be caught before the stringEquals rule.
return new sfn.Choice(this, "SelectPlanProtocol")
.when(sfn.Condition.isNotPresent("$.PlanProtocol"), planV2)
.when(sfn.Condition.stringEquals("$.PlanProtocol", "v2"), planV2)
.when(sfn.Condition.isPresent("$.PlanProtocol"), unsupportedPlanProtocol)
.otherwise(planV2);