Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(lambda): Not able to provision concurrency for the current version of a lambda #13731

Closed
tmhung88 opened this issue Mar 22, 2021 · 8 comments
Closed
Assignees
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. needs-triage This issue or PR still needs to be triaged.

Comments

@tmhung88
Copy link

tmhung88 commented Mar 22, 2021

Not able to provision concurrency for the current version of a lambda

Reproduction Steps

I have a simple stack below to configure provisioned concurrency for a lambda

export class LambdaAutoScalingStack extends cdk.Stack {
    constructor(scope: cdk.App, id: string) {
        super(scope, id);

        new lambda.Function(this, 'lambda1', {
            code: new lambda.InlineCode('exports.handler = async () => { console.log(\'hello world\'); };'),
            handler: 'index.handler',
            runtime: lambda.Runtime.NODEJS_10_X,
            currentVersionOptions: {
                provisionedConcurrentExecutions: 3
            }
        })

    }
}

What did you expect to happen?

The lambda should have concurrency provisioned as 3
image

What actually happened?

No concurrency was provisioned
image

Environment

  • CDK CLI Version : 1.94.1
  • Framework Version: 1.94.1
  • Node.js Version: v14.15.4
  • OS : Windows
  • Language (Version): TypeScript (3.9.7)

This is 🐛 Bug Report

@tmhung88 tmhung88 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 22, 2021
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Mar 22, 2021
@nija-at
Copy link
Contributor

nija-at commented Mar 26, 2021

Hi @tmhung88 -

Can you check what the CloudFormation template contains against the resource type AWS::Lambda::Version?
It should contain the ProvisionedConcurrencyConfig section.

If that is present, you can also run the get-provisioned-concurrency-config from the CLI and check whether that's configured.

Could you try these out and report back?

@nija-at nija-at added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 26, 2021
@github-actions
Copy link

github-actions bot commented Apr 3, 2021

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Apr 3, 2021
@tmhung88
Copy link
Author

tmhung88 commented Apr 3, 2021

Will set aside some time tomorrow to try again.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Apr 4, 2021
@tmhung88
Copy link
Author

tmhung88 commented Apr 4, 2021

@nija-at I don't see any ProvisionedConcurrencyConfig, or Lambda version in the the template.json.

Attached the template json
tmh-provisioned-lambda-stack.template.json.txt

@nija-at
Copy link
Contributor

nija-at commented Apr 7, 2021

Hi @tmhung88 -

currentVersionOptions take effect only when the currentVersion getter is called.

You will need to modify your code as -

const fn = new lambda.Function(...);
fn.currentVersion;

The last line actually creates the currentVersion.

@nija-at nija-at added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Apr 7, 2021
@tmhung88
Copy link
Author

tmhung88 commented Apr 7, 2021

Hi @tmhung88 -

currentVersionOptions take effect only when the currentVersion getter is called.

You will need to modify your code as -

const fn = new lambda.Function(...);
fn.currentVersion;

The last line actually creates the currentVersion.

Thanks. I confirm the provision is done when fn.currentVersion is called.

// The getter call is quite unexpected. It'd be great if the constructor lambdas.Function invokes this getter, or hide this detail from developers.

@tmhung88 tmhung88 closed this as completed Apr 7, 2021
@github-actions
Copy link

github-actions bot commented Apr 7, 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.

@ffxsam
Copy link

ffxsam commented Dec 20, 2021

@rix0rrr Are there any plans to fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants