aws-amplify / aws-amplify/amplify-cli

Python lambda is 2.6mb when there is 0 dependencies

Open
#5,566 20 comments 3 reactions 0 assignees View on GitHub
feature-request functions p3
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

**Describe the bug**
When create a function with a very simple Python lambda, the generated lambda is 2MB

**Amplify CLI Version**

4.30.0

**To Reproduce**

Take pointless lambda like this and build it.

```python3
def handler(event, context):
print("event:", event)
```

**Expected behavior**
The deployed lambda should only be a couple bytes not 2.6mb

**Screenshots**

![image](https://user-images.githubusercontent.com/5442469/95815361-4fb6a480-0cd1-11eb-9cab-60e78f7d527b.png)

**Desktop (please complete the following information):**
- OS: [e.g. Mac/Windows/Ubuntu]
Mac
- Node Version. You can use `node -v` to check the node version on your system
v14.13.1

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown Python handler and Amplify CLI version 4.30.0, then inspect the generated Lambda artifact and the packaging path that produces it. Done means a dependency-free handler is deployed as a substantially smaller artifact rather than approximately 2.6 MB, with the behavior covered by an appropriate test if the project has one.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
backend, cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.