-
Notifications
You must be signed in to change notification settings - Fork 4k
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: Step function definition does not include query language when using JSONata #33417
Comments
After analyzing the codebase, the issue stems from how query language handling is implemented in the AWS CDK Step Functions library. Here's what's happening:
aws-cdk/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke.ts Lines 176 to 192 in 47a3f90
3. The issue is that while the query language is used to determine the payload format, it's not being explicitly included in the ASL output as a QueryLanguage field. To fix this, we need to ensure the QueryLanguage field is consistently included in the ASL output. |
Thank you @pahud for the quick deep dive. Your attentiveness to the bugs I've reported is much appreciated! |
@joerino96 Hello, I am unable to reproduce this error. Consider this following stack I'm using which defines
The snippet of generated CFN template is as follows:
As you can see above, the Furthermore, looking at the code of TaskStateBase class which is the parent class of Would you provide some reproducible code for me so that I can further look into the issue? |
Hi @GavinZZ, I believe we can close this issue. When looking into my code I found I was using queryLanguage in the step function definition at the top level. This will set the default language for the entire step function. The queryLanguage inside the step can override the top-level default according to the step function ASL, which means that queryLanguage does not necessarily need to be set within the step. Unfortunately, for users to determine the query language being used, a user will need to invoke DescribeStateMachine API and then:
This is un-optimal for the testState API, which takes in a single step's definition and is unaware of the top level queryLanguage being set by the step function, but that's not a CDK problem :). |
Thanks for getting back to me! This exact issue happened to me when I was fixing other issues in JSONata and confuses me as I was testing at state-level! I can understand the frustration and I'll convey the finding with stepfunctions team and see if there's anything that they can do. That being said, will mark this issue as closed. |
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
When using JSONata, CDK does not always write the query language parameter to the step function definition, leading to undefined behavior.
This becomes a problem when using the DescribeStateMachine API and TestState API, where TestState using the definition from DescribeStateMachine from will assume the state is using JSONPath instead of JSONata.
This behavior is not consistent, as I have noticed that states within Maps do write the query language parameter to the state definition, while non nested states do not.
The work around is to manually add the QueryLanguage parameter to the definition before invoking TestState API.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The following CDK code:
consistently produces the step function step definition ASL:
Current Behavior
The following CDK code:
produces the step function step definition ASL:
Reproduction Steps
Possible Solution
jsonata constructors are mostly not writing the query language to ASL, with this behavior being undefined.
Additional Information/Context
No response
CDK CLI Version
2.178.1
Framework Version
No response
Node.js Version
Noe 18
OS
macOS 15.3
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: