My Step Function user role is giving an error for an AWS tutorial I am following.
I am doing this AWS Step Function tutorial: https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-continue-new.html
When I run the Step Function it failed on the "Iterator" Lambda function with this error:
Neither the global service principal states.amazonaws.com, nor the regional one is authorized to assume the provided role.
The role for my Iterator Lambda function has a Trust Policy set to this:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "states.us-east-1.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Any ideas on what is causing this error?
Thank you.
Neither the global service principal states.amazonaws.com, nor the regional one is authorized to assume the provided role.
This error can happen when you just created the role and the state machine in a short period of time. It takes a few seconds for IAM to propagate the new permissions.
The role defined for the function cannot be assumed by Lambda.
This means the IAM Role configured on your Lambda function does not allow Lambda to assume it.
The cause could not be determined because Lambda did not return an error type. Returned payload: {"errorMessage":"2022-06-06T15:02:36.302Z fcf6b434-6217-48f5-bf85-919a91456c28 Task timed out after 3.11 seconds"}
This error means you Lambda took more than 3s to execute (most likely you have a 3s timeout on your Lambda configuration) and the return to Step Functions was the Lambda execution timeout.
For me the Trust Policy looks ok. Could you double-check that your region is correct and the role is properly attached to the State Machine you want to use?
I tried that and still getting an error: "The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 403; Error Code: AccessDeniedException; Request ID: 82b2b3f2-ce43-4114-aaa4-ceef08c22470; Proxy: null)"
Then I checked the "Iterator" role and had to fix the trust policy for this to lambda: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.us-east-1.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
Now it runs further but breaks at the "Restart" function with this error: "The cause could not be determined because Lambda did not return an error type. Returned payload: {"errorMessage":"2022-06-06T15:02:36.302Z fcf6b434-6217-48f5-bf85-919a91456c28 Task timed out after 3.11 seconds"}"
Any ideas?
I have been troubleshooting this for a few days. Anyone able to help me with this?
Relevant questions
Unable To create a step function
asked 5 years agoStates.Runtime error when nested step function fails in Step Functions Local
asked a month agoAWS step function giving error, when I had included the "Parameter" tag
asked a month agoStep function state to execute a Glue job seems to be stalling
asked a year agoMy Step Function user role is giving an error for an AWS tutorial I am following.
asked a month agoAWS Step Function Output for container services
Accepted Answerasked 2 months agoStep Function Not Sending SNS Message
asked 19 days agoTrigger Step Function with API Gateway and use Fargate within Step Function?
asked 3 months agoIssue with Step Function Creation
asked 6 days agoStep Function error handling
asked 3 months ago
Thank you.
Yes. I had to make these two changes:
edit the timeout for the "Restart" function in "Configuration" -> "General configuration", I set the timeout to 5 minutes and 3 seconds.
I had to edit the "Restart" code to export handler:
Then deploy it after making the code change.
Now this successfully works!