Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Closed
ayankowsky opened this issue Jul 5, 2024 · 3 comments · Fixed by #30773
Closed

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

ayankowsky opened this issue Jul 5, 2024 · 3 comments · 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
@moelasmar moelasmar added the bug This issue is a bug. label Aug 28, 2024
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
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