chalice icon indicating copy to clipboard operation
chalice copied to clipboard

Chalice including Boto3 package even if it not included in the requirements.txt under runtime folder

Open joyanta3105 opened this issue 3 years ago • 1 comments

Hi Team,

We am using Chalice with Cdk to build and deploy APIs. We are observing an weird issue in the build process. Even if we didn't include Boto3 in the requirements.txt file in the runtime folders of out project, when we run a CDK synth, we see the zip file created includes the Boto3 components. To provide some more context, we are building the project manually on our laptop with CDK synth command. Could you pls explain this behavior?

Thanks for your help!

joyanta3105 avatar May 19 '22 19:05 joyanta3105

Interesting, I'm not seeing that behavior. I created a new cdk app from the "Rest API with a DynamoDB table" template and then updated my runtime/ file to not have any references to boto3:

$ cat runtime/app.py
from chalice import Chalice


app = Chalice(app_name='testcdk')


@app.route('/')
def index():
    return {}
$ cat runtime/requirements.txt
$ (empty)

When I synth the project, I don't see boto3 included in the assets:

$ cd infrastructure/
$ cdk synth
$ unzip -l cdk.out/asset.036b49eb9578ec2d26a69d057d3a4f1d0dd644deafa78b514328744d82a809fa.zip
Archive:  cdk.out/asset.036b49eb9578ec2d26a69d057d3a4f1d0dd644deafa78b514328744d82a809fa.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
    77715  01-01-1980 00:00   chalice/app.py
      548  01-01-1980 00:00   chalice/__init__.py
      109  01-01-1980 00:00   app.py
---------                     -------
    78372                     3 files

Maybe something in your runtime/requirements.txt file transitively depends on boto3?

jamesls avatar May 24 '22 20:05 jamesls