Zipfile is too big for deploy function
This is a (Bug Report / Feature Proposal)
Description
For bug reports:
- What went wrong?
- What did you expect should have happened?
- What was the config you used?
- What stacktrace or error message from your provider did you see?
When I try to deploy my function (in a rather large project), I can no longer do this invidually. Instead I get the following error
Request must be smaller than 69905067 bytes for the UpdateFunctionCode operation
When I deploy the entire project, I don't get any errors.
Looking into this, I noticed that the zip for the function is just as large as the zip for the entire project. This seems strange to me.
OS: linux │
Node Version: 6.8.0 │
Serverless Version: 1.0.2 │
For feature proposals:
- What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
- If there is additional config how would it look
Similar or dependent issues:
- #12345
Additional Data
- _Serverless Framework Version you're using_:
- _Operating System_:
- _Stack Trace_:
- _Provider Error messages_:
I confirmed it, the zip file contains the entire service. That means all functions, and not just the one that I want to deploy.
This is not a bug - unless otherwise specified, your service is bundled up and deployed as your function. This is why the packaging options exist.
Follow #2460 if you want to be involved in the future packaging configuration discussion.
Yup as @rowanu said serverless deploy function packages the same way that serverless deploy does so its reproducable. With the exclude options you should be able to get this up and running.
As this is not a bug and we're discussing next steps in packaging in another issue I'm closing here.
I noticed that both serverless deploy function and serverless deploy packages my functions the same way, same size, all fine, but only with serverless deploy that it uploads the zip files to S3 before updating aws lambda code:
Serverless: Injecting required Python packages to package...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service MY_LAMBDA_FUNCTION_1.zip file to S3 (69.31 MB)...
Serverless: Uploading service MY_LAMBDA_FUNCTION_2..zip file to S3 (43.67 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
.
.
.
(It completes)
So according to AWS the only limit here is 250MB unzipped, while serverless deploy function -f MY_LAMBDA_FUNCTION_1 uploads directly into aws lambda code and this has a 70MB~ish limit:
Serverless: Injecting required Python packages to package...
Serverless: Uploading function: MY_LAMBDA_FUNCTION_1 (69.37 MB)...
Serverless Error ---------------------------------------
Request must be smaller than 69905067 bytes for the UpdateFunctionCode operation