question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(function): Using Lambda .currentVersion results in deployment failures

See original GitHub issue

In 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:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ryparkercommented, Jul 29, 2021

👋 Relabeled this as guidance since this is not breaking CDK functionality. Let me know if you think otherwise.

0reactions
github-actions[bot]commented, Jul 29, 2021

⚠️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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[aws-lambda] Function.prototype.currentVersion does not ...
Function.prototype.currentVersion does not work when the code of the Lambda function is created using Code.fromCfnParameters().
Read more >
Troubleshoot execution issues in Lambda - AWS Documentation
Function execution errors can be caused by issues with your code, function configuration, downstream resources, or permissions. If you invoke your function ......
Read more >
lambda:GetAlias warning in CloudFormation stack update ...
I am just using the AWS resources created automatically by the CodeStar console. What do I do to fix this warning? Details. The...
Read more >
AWS Lambda $LATEST is dangerous
It has been my experience that most developers don't use function versions. Some “evidence” of this is: The AWS CDK has a bug...
Read more >
CodeDeploy — Boto3 Docs 1.26.34 documentation
The deployment shifts traffic from the original version of the Lambda function to the replacement version. For an Amazon ECS deployment, the content...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found