2 Answers
- Newest
- Most votes
- Most comments
2
The error "Invalid path '$.job_status' : Property ['job_status'] not found in path $" suggests a mismatch between your Lambda function's output and what the Step Function expects. To fix this, ensure the Lambda output correctly aligns with the Step Function's expected input, particularly for the Choice state.
Given the structure of your Step Function, here are a few things to consider correcting the issue:
- Confirm the Lambda returns
{"job_status": "COMPLETE"}
directly at the root of its JSON output. - If your Lambda output directly contains
job_status
at the root, ensure theOutputPath
in theCheckMacieJobStatus
state is"OutputPath": "$"
. - The
InputPath
in your Choice state might be unnecessary. Removing or adjusting it could resolve the error.
Corrected Step Function snippet:
"CheckMacieJobStatus": { "Type": "Task", "Resource": "arn:aws:states:::lambda:invoke", "OutputPath": "$", ... }, "Choice": { "Type": "Choice", "Choices": [ { "Variable": "$.job_status", "StringEquals": "RUNNING", "Next": "Wait120Seconds" }, { "Variable": "$.job_status", "StringEquals": "COMPLETE", "Next": "Success" } ] }
This assumes your Lambda function returns the expected structure. Align the Lambda's output or adjust the Step Function configuration accordingly.
0
by adding inputpath to $ fixed the issue>
{
"Comment": "Create Macie Job for the file.",
"StartAt": "CheckMacieJobStatus",
"States": {
"CheckMacieJobStatus": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"OutputPath": "$.Payload",
"InputPath": "$",
"Parameters": {
"Payload.$": "$",
"FunctionName": "arn:aws:lambda:${aws_region}:${aws_account_id}:function: lambdafunction_name ${environment}:$LATEST"
},
"Retry": [
{
"ErrorEquals": [
"Lambda.ServiceException",
"Lambda.AWSLambdaException",
"Lambda.SdkClientException",
"Lambda.TooManyRequestsException"
],
"IntervalSeconds": 2,
"MaxAttempts": 6,
"BackoffRate": 2
}
],
"Next": "Choice"
},
"Choice": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.jobStatus",
"StringEquals": "RUNNING",
"Next": "Wait300Seconds"
},
{
"Variable": "$.jobStatus",
"StringEquals": "COMPLETE",
"Next": "Success"
}
],
"InputPath": "$"
},
"Wait300Seconds": {
"Type": "Wait",
"Seconds": 300,
"Next": "CheckMacieJobStatus"
},
"Success": {
"Type": "Succeed"
}
}
}
Relevant content
- asked a year ago
- asked 2 years ago
- asked a year ago
- asked 3 years ago
- AWS OFFICIALUpdated 3 years ago
- What's the difference between Lambda function execution role permissions and invocation permissions?AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago