-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bug: Functions are permitted with invalid MemorySize
#6510
Comments
Thanks @davidjb. This particular validation is relevant to subsequent local commands, so to me this seems like something worth implementing. I will take it to the team for prioritization. |
The expectation of this issue was the feature request in #3244. We will track that feature request there. |
Patch is released in v1.115.0. Closing |
Description:
As described in #6110, SAM (
build
,local invoke
, etc) doesn't attempt to validate values for functionMemorySize
.This value should be with 128 and 10240 MB according to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-memorysize but values such as
1
,-1
, etc are allowed. For a Docker-based local invocation, a value < 6 MB will cause Docker to refuse to start the container.Steps to reproduce:
template.yml
:Observed result:
sam build MyFunction
succeeds, despiteMemorySize: 1
being an invalid value. Trying to invokesam local invoke MyFunction
fails because Docker requires a minimum of 6MB of memory allocated:Expected result:
Validation errors would be shown when the SAM config is loaded, before the values are used for building and builds would not succeed when invalid values are used.
As per #3244, this value will be validated but only at deploy time, assuming you're able to create a configuration that is able to be built but not deploy.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
The text was updated successfully, but these errors were encountered: