Reduce Lambda deployment size now botocore.vendored requests is deprecated

I’ve been using the requests library from botocore.vendored but in October it was deprecated. So I switched to using the Python requirements plugin. Following the instructions my deployments have gone from a few kilobytes to 30MB!

Is there a (much) smaller way to use the requests library? My requirements.txt is below … installing requests in a virtual env also brings in several other libraries as dependencies. Are they causing the bloat?

(Also … the instructions for the plugin meant boto3 was added to requirements.txt and thus the deployment went up to 80MB! So I’ve pulled that one out)

certifi==2019.9.11
chardet==3.0.4
idna==2.8
requests==2.22.0
urllib3==1.25.7

After inspecting the Zip, it turns out node_modules and venv were being included. After explicitly excluding them I’m down to 8.3MB