Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Bug: "cdk ls" performs Lambda function bundling when it shouldn't #683

Closed
imincik opened this issue May 7, 2021 · 5 comments
Closed

Bug: "cdk ls" performs Lambda function bundling when it shouldn't #683

imincik opened this issue May 7, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@imincik
Copy link
Contributor

imincik commented May 7, 2021

Bug Description

When running cdk ls command, CDK perfoms Lambda functions bundling instead of simply returning list of stacks. This takes lot of time and populates console output with bundling output which makes cdk ls command nearly useless and might also indicate some issues with our bundling code implementation

How to Reproduce

  1. Run cdk ls

What did you expect to happen?

Quickly see list of existing CDK stacks.

What actually happened?

cdk ls
Sending build context to Docker daemon  7.168kB
Step 1/9 : ARG IMAGE=amazon/aws-sam-cli-build-image-python3.7
Step 2/9 : FROM $IMAGE
 ---> 3bc716403376
Step 3/9 : RUN yum -q list installed rsync &>/dev/null || yum install -y rsync
 ---> Using cache
 ---> 8bdd24adccc3
Step 4/9 : RUN pip install --upgrade pip
 ---> Using cache
 ---> 91424be41e99
Step 5/9 : RUN pip install pipenv poetry
 ---> Using cache
 ---> 728ff3241d94
Step 6/9 : WORKDIR /var/dependencies
 ---> Using cache
 ---> 2244e0e32e5f
Step 7/9 : COPY Pipfile* pyproject* poetry* requirements.tx[t] ./
 ---> Using cache
 ---> ab757839316c
Step 8/9 : RUN [ -f 'Pipfile' ] && pipenv lock -r >requirements.txt;     [ -f 'poetry.lock' ] && poetry export --with-credentials --format requirements.txt --output requirements.txt;     [ -f 'requirements.txt' ] && pip install -r requirements.txt -t .;
 ---> Using cache
 ---> 223f30b77f79
Step 9/9 : CMD [ "python" ]
 ---> Using cache
 ---> 6bff30c4d06d
Successfully built 6bff30c4d06d
Successfully tagged cdk-4d5238e8716216d7ba210964ea914f7f90bd0a669a35450f95665d7f1fcda50c:latest
Sending build context to Docker daemon  7.168kB
Step 1/9 : ARG IMAGE=amazon/aws-sam-cli-build-image-python3.7
Step 2/9 : FROM $IMAGE
 ---> 3bc716403376
Step 3/9 : RUN yum -q list installed rsync &>/dev/null || yum install -y rsync
 ---> Using cache
 ---> 8bdd24adccc3
Step 4/9 : RUN pip install --upgrade pip
 ---> Using cache
 ---> 91424be41e99
Step 5/9 : RUN pip install pipenv poetry
 ---> Using cache
 ---> 728ff3241d94
Step 6/9 : WORKDIR /var/dependencies
 ---> Using cache
 ---> 2244e0e32e5f
Step 7/9 : COPY Pipfile* pyproject* poetry* requirements.tx[t] ./
 ---> Using cache
 ---> ab757839316c
Step 8/9 : RUN [ -f 'Pipfile' ] && pipenv lock -r >requirements.txt;     [ -f 'poetry.lock' ] && poetry export --with-credentials --format requirements.txt --output requirements.txt;     [ -f 'requirements.txt' ] && pip install -r requirements.txt -t .;
 ---> Using cache
 ---> 223f30b77f79
Step 9/9 : CMD [ "python" ]
 ---> Using cache
 ---> 6bff30c4d06d
Successfully built 6bff30c4d06d


Successfully tagged cdk-c8c0feb9194585da7387e36e04caed3931ac99074809d2e7d61ddbc67c4eb04f:latest
datalake

Software Context

Operating system:

Environment:

Relevant software versions:

  • AWS CLI:
  • Poetry:

Additional context

This issue is discussed here and should be already fixed in CDK.

Could this be related to the shebang line or main() call in our app.py?

@imincik imincik added the bug Something isn't working label May 7, 2021
@billgeo
Copy link
Contributor

billgeo commented May 13, 2021

First task is to investigate what is happening here and determine if this is having other impacts on CDK bundling and performance of deployment.

At that point we will decide what to do about it.

@imincik imincik self-assigned this May 13, 2021
@imincik
Copy link
Contributor Author

imincik commented May 13, 2021

What's happening here is that creation of Botocore Lambda layer in lambda_layers stack is apparently not excluded by CDK during cdk ls as is normal Lambda bundling process.

@imincik
Copy link
Contributor Author

imincik commented May 13, 2021

Also, lambda layer Docker image is huge - 2.31GB.

$ docker images
REPOSITORY                                                                  TAG       IMAGE ID       CREATED          SIZE
cdk-672bf63744b1b18c4e226ba82e4fabacf7cf625fe98b7a1be708f46f502c3ff0        latest    b3ad922ba205   19 minutes ago   2.31GB
cdk-a0ad30da29d650202654bd5829c2d17745e3f1c228a7ae87a6eb97e87fecacc4        latest    b3ad922ba205   19 minutes ago   2.31GB
amazon/aws-sam-cli-build-image-python3.8                                    latest    40e4293ff66e   2 weeks ago      2.16GB

@imincik
Copy link
Contributor Author

imincik commented May 18, 2021

I'll submit CDK issue for this

@imincik
Copy link
Contributor Author

imincik commented May 18, 2021

CDK bug report created: aws/aws-cdk#14747

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants