You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Step Functions: CloudFormation DefinitionS3Location with a YAML definition fails at CreateStateMachine (ASLParserException) — real AWS converts YAML→JSON, LocalStack does not
#37
Deploying an AWS::StepFunctions::StateMachine whose definition is supplied via DefinitionS3Location pointing at a YAML ASL file fails at create time:
Resource provider operation failed ... CreateStateMachine ...
InvalidDefinition: ASLParserException line 1:7, at :, mismatched input ':' expecting '{'
line 1:7 is the : after the top-level Comment: key — the raw YAML is being
handed to LocalStack's JSON-only ASL parser, i.e. the YAML→JSON conversion that
real CloudFormation performs for an S3-located definition isn't happening.
Expected behaviour
Real CloudFormation accepts a JSON or YAML file at DefinitionS3Location and
converts it before calling Step Functions, so the same template deploys on AWS.
LocalStack should perform the same YAML→JSON handling. (An inline JSON DefinitionString already works.)
How are you starting LocalStack?
localstack start -d (CLI)
Steps to reproduce
Author a state machine definition as YAML (statemachine.asl.yaml), e.g. with a
top-level Comment: key.
In CDK: new sfn.StateMachine(this, 'SM', { definitionBody: sfn.DefinitionBody.fromFile('statemachine.asl.yaml'), }) — fromFile emits DefinitionS3Location.
cdklocal bootstrap && cdklocal deploy.
→ Stack rolls back; the state machine is CREATE_FAILED with the ASLParserException above.
Workaround: convert YAML→JSON at synth and pass it inline as a DefinitionString — DefinitionBody.fromString(JSON.stringify(parse(readFileSync(...)))).
This deploys and executes correctly (verified: CREATE_COMPLETE, and an execution
succeeds with DefinitionSubstitutions resolving normally).
aws-cdk-lib 2.257.x via cdklocal (aws-cdk-local 3.0.4)
Host: macOS (Apple Silicon), Docker Desktop
Anything else?
AWS reference: the DefinitionS3Location docs state the file "must be a JSON or
YAML file." Same root-cause class as #5204, just on the S3-located path rather than
the inline Definition property.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Is there an existing issue / discussion for this?
I searched the Bugs category and the archived localstack/localstack tracker.
Closest prior art, none matching this path:
Definitionin YAML unsupported, inlineJSON
DefinitionStringworks. Reportedly fixed, but not forDefinitionS3Location.DefinitionS3Locationnot handled in the CFN update handler.Argumentsvia thevalidate API on a JSON definition), already fixed.
Current behaviour
Deploying an
AWS::StepFunctions::StateMachinewhose definition is supplied viaDefinitionS3Locationpointing at a YAML ASL file fails at create time:Resource provider operation failed ... CreateStateMachine ...
InvalidDefinition: ASLParserException line 1:7, at :, mismatched input ':' expecting '{'
line 1:7is the:after the top-levelComment:key — the raw YAML is beinghanded to LocalStack's JSON-only ASL parser, i.e. the YAML→JSON conversion that
real CloudFormation performs for an S3-located definition isn't happening.
Expected behaviour
Real CloudFormation accepts a JSON or YAML file at
DefinitionS3Locationandconverts it before calling Step Functions, so the same template deploys on AWS.
LocalStack should perform the same YAML→JSON handling. (An inline JSON
DefinitionStringalready works.)How are you starting LocalStack?
localstack start -d(CLI)Steps to reproduce
statemachine.asl.yaml), e.g. with atop-level
Comment:key.new sfn.StateMachine(this, 'SM', { definitionBody: sfn.DefinitionBody.fromFile('statemachine.asl.yaml'), })—fromFileemitsDefinitionS3Location.cdklocal bootstrap && cdklocal deploy.→ Stack rolls back; the state machine is
CREATE_FAILEDwith theASLParserExceptionabove.Workaround: convert YAML→JSON at synth and pass it inline as a
DefinitionString—DefinitionBody.fromString(JSON.stringify(parse(readFileSync(...)))).This deploys and executes correctly (verified:
CREATE_COMPLETE, and an executionsucceeds with
DefinitionSubstitutionsresolving normally).Environment
localstack/localstack-pro:dev— 2026.6.0.dev249 (build 2026-06-12, git 73bfaeb5e)Anything else?
AWS reference: the
DefinitionS3Locationdocs state the file "must be a JSON orYAML file." Same root-cause class as #5204, just on the S3-located path rather than
the inline
Definitionproperty.nb: This was authored via Claude
Beta Was this translation helpful? Give feedback.
All reactions