Boto3 Test State sending a different response than test state in AWS Console with JSONata
Describe the bug
When comparing the response from the test state api in the aws console vs the response of test state in boto3, there is an issue where boto3 will return the jsonata definition of the variable, but the console version of test state will return the evaluated variables as strings.
Regression Issue
- [ ] Select this option if this issue appears to be a regression.
Expected Behavior
Test state call in boto3. definition assigns variable "example" to $foo. { % $states.input.foo % }. input: {"input": "{foo:bar}"}
{
"output": "{\"foo\": \"bar\"}",
"inspectionData": {
"input": "{\"foo\": \"bar\"}",
"afterInputPath": "{\"foo\": \"bar\"}",
"afterParameters": "{\"foo\": \"bar\"}",
"afterResultSelector": "{\"foo\": \"bar\"}",
"afterResultPath": "{\"foo\": \"bar\"}",
"variables": "{\"example\":\"bar\"}"
},
"nextState": "baz",
"status": "SUCCEEDED",
"ResponseMetadata": {
"RequestId": "1234",
"HTTPStatusCode": 200,
"HTTPHeaders": {
"x-amzn-requestid": "1234",
"date": "Tue, 20 May 2025 17:02:41 GMT",
"content-type": "application/x-amz-json-1.0",
"content-length": "342",
"connection": "keep-alive"
},
"RetryAttempts": 0
}
}
Current Behavior
Test state call in boto3. definition assigns variable "example" to $foo. { % $states.input.foo % }. input: {"input": "{foo:bar}"}
state definition:
{
"Assign": {
"example": "{% $states.input.foo %}",
},
"Next": "baz",
"Type": "Pass",
}
{
"output": "{\"foo\": \"bar\"}",
"inspectionData": {
"input": "{\"foo\": \"bar\"}",
"afterInputPath": "{\"foo\": \"bar\"}",
"afterParameters": "{\"foo\": \"bar\"}",
"afterResultSelector": "{\"foo\": \"bar\"}",
"afterResultPath": "{\"foo\": \"bar\"}",
"variables": "{\"example\":\"{% $states.input.foo %}\"}"
},
"nextState": "baz",
"status": "SUCCEEDED",
"ResponseMetadata": {
"RequestId": "1234",
"HTTPStatusCode": 200,
"HTTPHeaders": {
"x-amzn-requestid": "1234",
"date": "Tue, 20 May 2025 17:02:41 GMT",
"content-type": "application/x-amz-json-1.0",
"content-length": "342",
"connection": "keep-alive"
},
"RetryAttempts": 0
}
}
Reproduction Steps
def foo(self) -> None:
state_def = {
"Assign": {
"example": "{% $states.input.foo %}",
},
"Next": "baz",
"Type": "Pass",
}
i = {
"foo": "bar",
}
response = client.test_state(
definition=json.dumps(state_def),
roleArn="arn:aws:iam::123456789012:role/myRole",
input=json.dumps(i),
inspectionLevel="TRACE",
)
j = json.dumps(response)
print(j)
variables = json.loads(response["inspectionData"]["variables"])
print(json.dumps(variables))
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.38.19
Environment details (OS name and version, etc.)
Linux 5.15.167.4-microsoft-standard-WSL2 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
Hello @dylanmccormick, thanks for reaching out. I have replicated wit test_state API and have received the same result: {"example":"{% $states.input.foo %}"}. I have reached out to the Step Functions team and will update if there are any updates. Please let me know if you have any questions. Thank you.
For Internal Tracking: P248922317
Hello @dylanmccormick, the Service Team has mentioned that JSONata should be added as QueryLanguage
e.g.
state_def = {
"QueryLanguage": "JSONata"
...
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.