[英]Serverless Framework - AWS Lambda dependency limit exceed
I am working in a serverless project with AWS (a kind of call center, using Twilio). 我正在使用AWS(一种使用Twilio的呼叫中心)进行无服务器项目。 I have previously built another 2-3 little projects. 我以前已经建立了另外2-3个小项目。 I am using Serverless Framework now, though. 我现在正在使用无服务器框架。 I didn't use it so far. 到目前为止,我还没有使用它。 So I am quite a newbie in both, AWS and Serverless. 因此,无论是AWS还是无服务器,我都是一个新手。
I am somehow following the next link: https://serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/ 我不知何故跟随下一个链接: https : //serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/
So I am basically using this Python dependecies: Flask, Twilio, boto3 (for AWS). 因此,我基本上使用了以下Python依赖项:Flask,Twilio,boto3(适用于AWS)。 See requirements.txt below. 请参阅下面的requirements.txt。 I uninstalled some packages, however there probably are some packages I could clean: 我卸载了一些软件包,但是可能有一些可以清理的软件包:
boto3==1.9.84
botocore==1.12.84
certifi==2018.11.29
chardet==3.0.4
Click==7.0
docutils==0.14
Flask==1.0.2
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10
jmespath==0.9.3
lazy-object-proxy==1.3.1
MarkupSafe==1.1.0
pipdeptree==0.13.2
PyJWT==1.7.1
PySocks==1.6.8
python-dateutil==2.7.5
pytz==2018.9
requests==2.21.0
s3transfer==0.1.13
six==1.12.0
twilio==6.23.1
urllib3==1.24.1
Using Serverless Framework I was able to deploy (serverless deploy) the project without issues until I installed boto3. 使用无服务器框架,在安装boto3之前,我能够无问题地部署(无服务器部署)项目。 However, now I exceed allowed dependency size and get this error: 但是,现在我超过了允许的依赖项大小,并收到此错误:
An error occurred: AppLambdaFunction - Unzipped size must be smaller than 262144000 bytes (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
I'm stuck on this. 我一直坚持下去。 I guess I could solve it the old way, without using Serverless Framework (directly in AWS), but I would ideally like to solve this issue. 我想我可以不使用Serverless Framework(直接在AWS中使用)而以旧方式解决此问题,但理想情况下,我想解决此问题。
Is it possible to partially install boto3? 是否可以部分安装boto3? I mean, a way to install just the modules I need. 我的意思是,一种只安装我需要的模块的方法。
Any other idea? 还有其他想法吗?
Thanks in advance. 提前致谢。
Luckily, you don't have to bundle boto3
when deploying your Lambda application. 幸运的是,在部署Lambda应用程序时,您不必捆绑boto3
。 It is already present in the Lambda python execution environment. 它已经存在于Lambda python执行环境中。 Feel free to remove boto3 from your requirements.txt
. 随时从您的requirements.txt
删除boto3。
Note that AWS recommends you bundle your own as the one in Lambda might not be fully up-to-date, but that matters only if you want to use the very latest feature or services of AWS. 请注意,AWS建议您捆绑自己的捆绑包,因为Lambda中的捆绑包可能不是最新的,但这仅在您要使用AWS的最新功能或服务时才重要。 I've been using the bundled one for over 2 years and haven't had an issue once. 我已经使用捆绑的产品超过2年了,并且一次都没有出现问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.