解压后的大小必须小于 262144000 字节 - AWS Lambda 错误 [英] Unzipped size must be smaller than 262144000 bytes - AWS Lambda Error
问题描述
我尝试使用 servless/lambda 函数 AWS 上传我的应用程序,但我遇到了这个问题:
I have tried to upload my application using servless/lambda function AWS, but i got this issue:
发生错误:AppLambdaFunction - 解压后的大小必须小于 262144000 字节(服务:AWSLambdaInternal;状态代码:400;错误代码:InvalidParameterValueException;请求 ID:8ea0d887-5743-4db1-96cd-6c5efa57b81).
An error occurred: AppLambdaFunction - Unzipped size must be smaller than 262144000 bytes (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 8ea0d887-5743-4db1-96cd-6c5efa57b081).
解决问题的最佳方法是什么?
What is the best way to resolve it?
看看我的依赖:
"dependencies": {
"ethereumjs-tx": "^1.3.7",
"aws-sdk": "^2.4.52",
"body-parser": "^1.18.3",
"compression": "^1.7.4",
"consign": "^0.1.6",
"cors": "^2.8.5",
"express": "^4.16.4",
"helmet": "^3.16.0",
"moment": "^2.24.0",
"openzeppelin-solidity": "^2.3.0",
"serverless": "^1.48.2",
"serverless-http": "^1.9.1",
"serverless-offline": "^4.9.4",
"truffle": "^5.1.9",
"truffle-hdwallet-provider": "^1.0.17",
"web3": "^1.2.5-rc.0"
},
Serverless.yml:
Serverless.yml:
provider:
name: aws
runtime: nodejs8.10
stage: v1
region: us-east-1
timeout: 30
memorySize: 512
package:
excludeDevDependencies: true
exclude:
- .git/**
- .vscode/**
- venv/**
functions:
app:
handler: handler.run
events:
- http:
path: /
method: ANY
cors: true
- http:
path: /{proxy+}
method: ANY
cors: true
plugins:
- serverless-offline
推荐答案
在 serverless.yml 文件中使用指令 exclude
.在 Python 的情况下,我是这样使用它的:
Use the directive exclude
at your serverless.yml file. In case of Python, I've been used it as follows:
package:
exclude:
- node_modules/**
- venv/**
构建过程会在发送到 AWS 之前将它们从构建中排除.
The build process will exclude them from the build before sending to AWS.
提示我在 Github 上获得了这个问题.此指令的文档在此处详细介绍.
Tip I got in this issue at Github. The documentation for this directive is detailed here.
这篇关于解压后的大小必须小于 262144000 字节 - AWS Lambda 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!