Package command uploads entire directory when using SAM InlineCode
SAM recently released support for InlineCode, however, when the package command gets run it zips+uploads the entire current directory (even though it doesn't get used). I believe this is the issue https://github.com/aws/aws-cli/blob/d0fd4d2e2856e441156c0ba333eb119c7abd977e/awscli/customizations/cloudformation/artifact_exporter.py#L125.
Repro:
Create a SAM template with the following Resource:
MyFunction:
Type: AWS::Serverless::Function
Properties:
InlineCode: |
exports.handler = async (event) => {
return event
}
Handler: index.handler
Runtime: nodejs8.10
Run aws cloudformation package command.
Result: You can see the entire current directory gets zipped and uploaded to S3.
Expected: It doesn't.
Hi @brettstack, seems a reasonable request, marking as a feature request.
Pinging @sanathkr for thoughts.
This is a related issue: https://github.com/awslabs/aws-sam-cli/issues/1644 sam-cli fixed an issue with upload when InlineCode is used, aws-cli still has the same issue
Just ran into this in 2022 on aws-cli/2.7.32 Python/3.9.11 Darwin/19.6.0 exe/x86_64 prompt/off aws cli uploaded a 300MB zip archive for my inline lambda@edge function....