Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stepfunctions] Choice state does not allow state input (Json path '$') as a condition #8990

Closed
shivlaks opened this issue Jul 10, 2020 · 0 comments · Fixed by #8991
Closed
Assignees
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@shivlaks
Copy link
Contributor

Choice state Conditions are currently restricted to variables that must start with $. or $[, however, the state input of $ is also valid but not supported.

Reproduction Steps

const choiceState = new sfn.Choice(this, 'Are there things to do?');

const chain = sfn.Chain.start(choiceState.when(
  sfn.Condition.stringEquals('$', 'No messages'), finish)
  .otherwise(doOtherStuff),
);

const sm = new sfn.StateMachine(this, 'State Machine', {
  definition: chain,
});

another example that uses the Choice state with a condition on '$' is the sample map state state machine in the Step Functions documentation.

Error Log

When synthesizing a state machine with a choice state that verifies '$', the error message presented is:

Variable reference must start with '$.' or '$[', got '$'

Environment

  • CLI Version : 1.51.0
  • Framework Version: 5.0.0
  • Node.js Version: 12.16.3
  • OS : macOS 10.15.5
  • Language (Version): Typescript (3.9.6)

Other


This is 🐛 Bug Report

@shivlaks shivlaks added bug This issue is a bug. p1 @aws-cdk/aws-stepfunctions Related to AWS StepFunctions effort/small Small work item – less than a day of effort labels Jul 10, 2020
@shivlaks shivlaks self-assigned this Jul 10, 2020
shivlaks added a commit that referenced this issue Jul 10, 2020
…ition

Choice state Conditions are currently restricted to variables that must start
with $. or $[, however, the state input of $ is also valid.

This change relaxes the validation on the Condition to allow the state input
'$' to be supplied.

Closes #8990
@mergify mergify bot closed this as completed in #8991 Jul 15, 2020
mergify bot pushed a commit that referenced this issue Jul 15, 2020
…ition (#8991)

Choice state Conditions are currently restricted to variables that must start
with $. or $[, however, the state input of $ is also valid.

Conditions evaluate against strings. Currently, we only allow attributes in the 
state input, but not the entire state input. The state input can be an object or
a plain string (i.e. "No messages").

This change relaxes the validation on the Condition to allow the state input
'$' to be supplied. This allows a string in a state input to be used in a condition
when using Choice states


Closes #8990

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
curtiseppel pushed a commit to curtiseppel/aws-cdk that referenced this issue Aug 11, 2020
…ition (aws#8991)

Choice state Conditions are currently restricted to variables that must start
with $. or $[, however, the state input of $ is also valid.

Conditions evaluate against strings. Currently, we only allow attributes in the 
state input, but not the entire state input. The state input can be an object or
a plain string (i.e. "No messages").

This change relaxes the validation on the Condition to allow the state input
'$' to be supplied. This allows a string in a state input to be used in a condition
when using Choice states


Closes aws#8990

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant