(function): Using Lambda .currentVersion results in deployment failures
See original GitHub issueIn a single application, we are attempting to create lambdas in some stack A and pass them to some stack B to be used in a state machine definition. In the state machine, we are using lambdaFunction.currentVersion
, because we have long running workflows and a lambda deployment in the middle could break ongoing executions.
The problem that we are facing is that since we are using the current version of our lambdas, the output of stack A is not the lambda, but rather the version of the lambda. Functionally, this works fine until we try and deploy to Stack A. Because the lambda version is the output, CFN attempts to delete the lambda version and bring up a new one, but fails because the lambda version is in use by Stack B.
Reproduction Steps
A basic code path is as follows: app.ts :
// <import statements>
const stackA = new StackAStack(<parameters>)
const stackB = new StackBStack(<parameters>, stackA.functionA)
StackAStack.ts
// <import statements>
export class StackAStack extends... {
readonly functionA: Function;
<... constructor>
}
StackBStack.ts
// <import statements>
export interface StackBStackProps {
...
readonly functionA: Function;
}
export class StackBStack extends... {
constructor(props: StackBStackProps, ...) {
const invoke = new LambdaInvoke ({
lambdaFunction: props.functionA.currentVersion,
.....
}
const definition = invoke.next(done);
const stateMachineA = new StateMachine(<some props>, definition))
}
}
Environment
- Node.js Version: 12.x
- OS : MacOs
- Language (Version): TypeScript
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
👋 Relabeled this as guidance since this is not breaking CDK functionality. Let me know if you think otherwise.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.