serverless-framework - 无服务器框架 : Request must be smaller than 69905067 bytes for the UpdateFunctionCode operation

标签 serverless-framework

我正在使用包上传压缩文件,如

frameworkVersion: "=1.27.3"

service: recipes

provider:
  name: aws
  endpointType: REGIONAL
  runtime: python3.6
  stage: dev
  region: eu-central-1
  memorySize: 512
  deploymentBucket:
    name: dfki-meta
  versionFunctions: false
  stackTags:
    Project: DFKIAPP
  # Allows updates to all resources except deleting/replacing EC2 instances
  stackPolicy:
    - Effect: Allow
      Principal: "*"
      Action: "Update:*"
      Resource: "*"
    - Effect: Deny
      Principal: "*"
      Action:
        - Update: Replace
        - Update: Delete
      Resource: "*"
      Condition:
        StringEquals:
          ResourceType:
            - AWS::EC2::Instance
  # Access to RDS and S3 Bucket
  iamRoleStatements:
    -  Effect: "Allow"
       Action: "s3:ListBucket"
       Resource: "*"


package:
  individually: true

functions:
#  get_recipes:
#    handler: handler.get_recipes
#    module: recipes_crud
#    package:
#      individually: true
#    timeout: 30
#    events:
#      - http:
#          path: recipes
#          method: get
#          request:
#            parameters:
#              querystring:
#                persona: true

  get_recommendation:
    handler: handler.get_recommendation
    module: recipes_ml
    package:
      artifact: zipped_dir.zip
    timeout: 30
    events:
      - http:
          path: recipes/{id}
          method: get
          request:
            parameters:
              paths:
                id: true
              querystring:
                schaerfe_def: true
                saettig_def: true
                erfahrung_def: true
                schaerfe_wunsch: true
                saettig_wunsch: true
                erfahrung_wunsch: true
                gericht_wunsch: true
                stimmung_wunsch: true

无法理解这个错误,69905067 字节下不是 52.18 吗?
(node:50928) ExperimentalWarning: The fs.promises API is experimental
Serverless: Packaging function: get_recommendation...
Serverless: Uploading function: get_recommendation (52.18 MB)...

  Serverless Error ---------------------------------------

  Request must be smaller than 69905067 bytes for the UpdateFunctionCode operation

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           10.1.0
     Serverless Version:     1.27.3

最佳答案

根据文档,包大小应小于 50MB
https://docs.aws.amazon.com/lambda/latest/dg/limits.html
enter image description here

来自 this blog post

The 20 MB addition presumably is there there to account for request overhead involved with the AWS API (e.g. base64 encoding of the zip file data). So far the 50 MB limit holds true-ish. But, we’re not defeated yet.

关于serverless-framework - 无服务器框架 : Request must be smaller than 69905067 bytes for the UpdateFunctionCode operation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50674084/

相关文章:

amazon-web-services - 无服务器 - 无法使用 cloudwatch 事件触发 aws lambda

serverless - 无服务器函数每次调用时都会安装模块吗?

java - 使用无服务器框架和 GraalVM 在 Java 上运行 AWS Lambda 函数

amazon-web-services - AWS API 网关身份验证(Cognito 与自定义授权器)

terraform - 无服务器框架 CORS 无法部署到 AWS CloudFormation

amazon-web-services - 如何在 s3 存储桶内创建文件夹 - 无服务器框架

javascript - `{where: ' 原始查询'}` 的支持已被删除

yaml - 无服务器变量插值 env:VAR 使用 Fn::GetAtt 回退

debugging - 在 vscode 中调试 Serverless 时未命中断点

node.js - 无服务器框架无法识别 tsconfig 的路径