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

aws_cdk.aws_lambda.Code: from_inline method code size limit incorrect #30761

Open
ayankowsky opened this issue Jul 5, 2024 · 1 comment · May be fixed by #30773
Open

aws_cdk.aws_lambda.Code: from_inline method code size limit incorrect #30761

ayankowsky opened this issue Jul 5, 2024 · 1 comment · May be fixed by #30773
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. documentation This is a problem with documentation. effort/small Small work item – less than a day of effort p2

Comments

@ayankowsky
Copy link

Describe the issue

The CDK documentation for from_inline states the code parameter has a size limit of 4KiB. However, this limit is actually 4MB according to the CloudFormation documentation for ZipFile size, which is what from_inline will synthesize to.

I tested this by providing a string that was larger than 4KB, and CDK successfully synthesized a template without error.

Links

https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_lambda/Code.html#aws_cdk.aws_lambda.Code.from_inline
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html

@ayankowsky ayankowsky added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Jul 5, 2024
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Jul 5, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 5, 2024
@khushail khushail self-assigned this Jul 5, 2024
@khushail
Copy link
Contributor

khushail commented Jul 5, 2024

Thanks @ayankowsky for reporting this. Indeed, its mentioned in clodufromation as

``
(Node.js and Python) The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package. This zip file cannot exceed 4MB. For the Handler property, the first part of the handler identifier must be index. For example, index.handler..

@khushail khushail added p3 effort/small Small work item – less than a day of effort p2 and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. p3 labels Jul 5, 2024
@khushail khushail removed their assignment Jul 5, 2024
@msambol msambol linked a pull request Jul 7, 2024 that will close this issue
1 task
@moelasmar moelasmar added the bug This issue is a bug. label Aug 28, 2024
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. documentation This is a problem with documentation. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants