aws / aws/aws-cdk

(stepfunctions): CDK generated stepfunction roles breaking inflight stepfunction executions with versioned lambdas

Open
#17,515 13 comments 6 reactions 0 assignees View on GitHub
@aws-cdk/aws-stepfunctions bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### What is the problem?

Using stepfunction auto generate of stepfunction roles and also use versioned lambdas in the step functions. On deployment, the stepfunction role is updated with the new lambda version. This causes invoke:lambda role failures in in-flight stepfunction executions as they will have the previous lambda version in their stepfunction execution definition but will now have the newer lambda version in the stepfunction role.

Is there way to have stepfunction auto generated roles to not include the lambda version in the role?

### Reproduction Steps

Create a stepfunction that invokes a lambda version. The stepfunction role will contain a lambda version

### What did you expect to happen?

Stepfunctions to not fail on inflight executions during a deployment

### What actually happened?

Stepfunction lambda:invoke errors on mismatched lambda versions:
Error

Lambda.AWSLambdaException

Cause

User: arn:aws:sts::335321747591:assumed-role/TidewaterWorkflowsCreateJ-CreateJournalStateMachin-184QJ29APKE3O/VAqgLpXDrcGwUULKzfuDBGJmuwiKLfzI is not authorized to perform: lambda:InvokeFunction on resource: arn:aws:lambda:us-west-2:335321747591:function:LogResources:28 because no identity-based policy allows the lambda:InvokeFunction action (Service: AWSLambda; Status Code: 403; Error Code: AccessDeniedException; Request ID: 6ccb7c61-369f-4826-9fc6-113954ec38c8; Proxy: null)

### CDK CLI Version

1.130.0 (build 9c094ae)

### Framework Version

_No response_

### Node.js Version

12

### OS

macos 10.15.7

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a TypeScript CDK stack using an auto-generated Step Functions role and a versioned Lambda, as described in the reproduction steps. Inspect the generated role policy and deployment behavior; done means in-flight executions can invoke their referenced Lambda versions after a deployment without an authorization failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.