AWS StepFunctions: sum() function returns error about not finding path
0
I have a StepFunction with input:
{
"Jobs": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0]
}
and I want the sum of the values in this array. According to the Json-Path docs there should exist a .sum()
function for this. When I try it here it even works. So I defined the following Pass state:
"Sum Jobs": {
"Type": "Pass",
"Parameters": {
"Jobs.$": "$.Jobs.sum()"
}
},
Nevertheless executions fail with:
"An error occurred while executing the state 'Sum Jobs' (entered at the event id #249). The JSONPath '$.Jobs.sum()' specified for the field 'Jobs.$' could not be found in the input '{\"Jobs\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0]}'"
asked 2 months ago4 views
1 Answers
-1
AWS Step Functions does not support functions in the path reference. It uses JSONPath expressions to identify a node, however has the following constraints:
- You can access object fields using only dot (.) and square bracket ( ) notation.
- The operators @ .. , : ? * aren't supported.
- Functions such as length() aren't supported.
This Step Functions documentation that covers this can be found here.
answered 2 months ago
Relevant questions
I am having an issue in API Gateway that says " No integration defined for method" when I attempt to deploy
asked a month agoFAILED: Execution Error, return code 1
asked 3 years agoScheduling local lambda function
asked a year agoIs Lambda invocation = 0 is a guaranteed metric that proves the Lambda function was unused during the period I provide to metric?
Accepted Answerasked a month agoCan I specify GET URL path parameter in step function?
asked 2 months agoInternal Server Error from API Gateway when sending queries through gateway to Lambda function connected to RDS database
asked a month agoHow to delete glue interactive session from the list of sessions?
asked 3 months agoAWS StepFunctions: sum() function returns error about not finding path
asked 2 months agoHow to delete jobs?
asked a year agoCloudFront does not seem to invoke lambda@edge function
asked 3 months ago
This is only valid for Reference Paths: i.e. ItemsPath, ResultPath and OutputPath. However InputPath, Parameters and ResultSelector can use the whole JsonPath syntax. I use filter expressions in these regularly. If you read the docs closely it distinguishes between normal and reference paths in the section you linked to and then states in each section which path is a reference path. For example in the blue box here