Not able to call sendTaskSuccess from lamda function

23 Views Asked by At

I have a lamda function from which I want to update status for step function using the SFN sdk method sendTaskSuccessCommand.
Here is the code that I am using
import { SFNClient, SendTaskSuccessCommand, SendTaskFailureCommand } from "@aws-sdk/client-sfn";
....
const client = new SFNClient({'region': 'us-east-1'});
const command = new SendTaskSuccessCommand(input);
const response = await client.send(command);

When I test this lamda with a valid task token, I get following error.

error User: <my user arn>:assumed-role/<my lamda role arn> is not authorized to perform: states:SendTaskSuccess on resource: <my step function arn> because no identity-based policy allows the states:SendTaskSuccess action

To fix this error, I added following permission to my lamda role

{
    "Effect": "Allow",
    "Action": [
        "logs:CreateLogGroup",
        "states:SendTaskFailure",
        "states:SendTaskSuccess"
      ],
      "Resource": "resource arn"
}

But I still get the same error.
How can I fix this?

0

There are 0 best solutions below