简体   繁体   English

无服务器框架-AWS Lambda依赖项限制超出

[英]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.

相关问题 使用无服务器框架将库/依赖项注入 AWS Lambda - Injecting libraries/dependencies into AWS Lambda with Serverless Framework AWS Lambda 运行 tensorflow 包超过限制 250 MB - AWS Lambda running tensorflow packages exceed limit 250 MB 使用无服务器框架将 Python package 部署到 AWS lambda 时出错 - Error deploying Python package to AWS lambda using Serverless framework 使用无服务器框架为 AWS Lambda 构建和使用本地包 - Build and use local package for AWS Lambda using serverless framework 通过 GitHub 操作和无服务器框架部署 AWS Lambda 时找不到好的绑定路径格式 - Unable to find good bind path format when deploying AWS Lambda via GitHub action and serverless framework 如何在无服务器框架中将外部 python 模块导入您的 AWS Lambda 函数? - How to import external python modules to your AWS Lambda functions, in serverless framework? AWS Lambda 和 Python 中的 Open CV 的无服务器问题 - Serverless issue with AWS Lambda and Open CV in Python 无服务器框架 Python lambda 直接返回 JSON - Serverless Framework Python lambda return JSON directly 无服务器框架 - useDotenv 未在 AWS 中加载 env 文件 - Serverless Framework - useDotenv is not loading env file in AWS 没有名为pymysql的模块-AWS Serverless Framework - No module named pymysql - aws serverless framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM