aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

(aws-s3-deployment): BucketDeployment creates Lambda function with unsupported runtime

Open s1mrankaur opened this issue 2 years ago • 3 comments

Describe the bug

Basically what happens is the class BucketDeployment from the aws-s3-deployment creates a Lambda function (a child in this case) which has as its runtime Python 3.6 but Lambda doesn't support this version anymore. So, when deploying the stack, CloudFormation raises the following error:

Resource handler returned message: "The runtime parameter of python3.6 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (python3.9) while creating or updating functions. The problem is also the fact I cannot set the runtime I want to neither in CDK v1 nor CDK v2.

Expected Behavior

I'd expect CDK to set a supported Runtime by Lambda

Current Behavior

CDK is setting Python 3.6 as default runtime and not allowing me to specify another runtime

Reproduction Steps

Deploy a stack from https://github.com/awslabs/aws-simple-cicd . It will fail reporting the version issue

Possible Solution

A possible solutions is to allow the runtime specification in the BucketDeployment class. Another solution (not the one I prefer) is to hardcode the runtime as it currently is but use one supported instead.

Additional Information/Context

No response

CDK CLI Version

2.35.0

Framework Version

No response

Node.js Version

14.8.0

OS

Windows

Language

Typescript, Python

Language Version

No response

Other information

No response

s1mrankaur avatar Aug 05 '22 00:08 s1mrankaur

@otaviomacedo This should be already resolved. See discussion in #21467.

jumic avatar Aug 05 '22 15:08 jumic

@jumic Thanks for linking. I already updated cdk in packagej.json

"devDependencies": { "@aws-cdk/aws-codebuild": "1.119.0", "@aws-cdk/aws-codecommit": "1.119.0", "@aws-cdk/aws-codepipeline": "1.119.0", "@aws-cdk/aws-codepipeline-actions": "1.119.0", "@aws-cdk/aws-ec2": "1.119.0", "@aws-cdk/aws-ecr": "^1.119.0", "@aws-cdk/aws-events-targets": "1.119.0", "@aws-cdk/aws-iam": "1.119.0", "@aws-cdk/aws-lambda": "1.119.0", "@aws-cdk/aws-s3": "1.119.0", "@aws-cdk/aws-sns": "1.119.0", "@aws-cdk/aws-sns-subscriptions": "1.119.0", "@aws-cdk/core": "1.119.0", "@types/node": "15.6.1", "aws-cdk": "2.35.0", "aws-sdk": "^2.792.0", "husky": "^4.3.0", "ts-node": "^10.3.0", "tsort": "0.0.1", "typescript": "^4.0.5" }, "dependencies": { "@aws-cdk/aws-s3-deployment": "1.119.0", "@aws-cdk/aws-secretsmanager": "1.119.0", "@aws-cdk/aws-ssm": "1.119.0", "@aws-cdk/cloudformation-diff": "^1.119.0", "cdk-assets": "^1.124.0", "source-map-support": "^0.5.19" } }

Still running into this issue though.

s1mrankaur avatar Aug 09 '22 15:08 s1mrankaur

@s1mrankaur have you tried with version 2?

otaviomacedo avatar Aug 10 '22 15:08 otaviomacedo

@otaviomacedo Ended up upgrading individual packages to 1.167.0 and that worked

s1mrankaur avatar Aug 12 '22 19:08 s1mrankaur

Closing this since it's been resolved

TheRealAmazonKendra avatar Aug 24 '22 14:08 TheRealAmazonKendra

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

github-actions[bot] avatar Aug 24 '22 14:08 github-actions[bot]

Hello @s1mrankaur can you please share your final version of package.json to confirm the changes? I tried the mentioned solution, but it didn't work for me.

klebertertulino avatar Aug 25 '22 16:08 klebertertulino

Same Here. I tried the mentioned solution, but it didn't work for me. @s1mrankaur Please share your final version of package.json

sunilksahoo avatar Aug 26 '22 05:08 sunilksahoo

@sunilksahoo @klebertertulino

Upgrading @aws-cdk/aws-s3-deployment to 1.167.0 fixed the issue.

"devDependencies": { "@aws-cdk/aws-codebuild": "1.167.0", "@aws-cdk/aws-codecommit": "1.167.0", "@aws-cdk/aws-codepipeline": "1.167.0", "@aws-cdk/aws-codepipeline-actions": "1.167.0", "@aws-cdk/aws-ec2": "1.167.0", "@aws-cdk/aws-ecr": "^1.167.0", "@aws-cdk/aws-events-targets": "1.167.0", "@aws-cdk/aws-iam": "1.167.0", "@aws-cdk/aws-lambda": "1.167.0", "@aws-cdk/aws-s3": "1.167.0", "@aws-cdk/aws-sns": "1.167.0", "@aws-cdk/aws-sns-subscriptions": "1.167.0", "@aws-cdk/core": "1.167.0", "@types/node": "15.6.1", "aws-cdk": "^2.35.0", "aws-sdk": "^2.792.0", "husky": "^4.3.0", "ts-node": "^10.3.0", "tsort": "0.0.1", "typescript": "^4.0.5" }, "dependencies": { "@aws-cdk/aws-s3-deployment": "1.167.0", "@aws-cdk/aws-secretsmanager": "1.167.0", "@aws-cdk/aws-ssm": "1.167.0", "@aws-cdk/cloudformation-diff": "^1.167.0", "cdk-assets": "^1.124.0", "source-map-support": "^0.5.19" }

s1mrankaur avatar Aug 26 '22 19:08 s1mrankaur