有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

scala AWSJAVASDK:解压缩大小必须小于262144000字节

我正在尝试使用SAM-CLI在scala中的AWS上部署一个lambda函数

它工作得很好,但是当我将依赖项添加到构建中时。sbt

  "com.amazonaws" % "aws-java-sdk" % "1.11.46"

部署失败并返回

"Unzipped size must be smaller than 262144000 bytes (Service: Lambda, Status Code: 400, Request ID: 53eeb ab6-9377-4a37-b20b-9e55ccbebd72, Extended Request ID: null)"

                                                                                                                  

我的职能是

    def handle(request: APIGatewayProxyRequestEvent, context: Context): Response = {
    
    println("handling %s %s, remaining time is %d ms".format(
      request.getHttpMethod, request.getPath, context.getRemainingTimeInMillis) )
    
    println(s"""environment = ${sys.env.getOrElse("env", "n/a")}""")

    val name = request.getPathParameters.get("name")
    Response(s"Hello, $name\n", Map("Content-Type" -> "text/plain"))
  }
  
  case class Response(body: String, headers: Map[String,String], statusCode: Int = 200) {
    def javaHeaders: java.util.Map[String, String] = headers.asJava `enter code here`}

还有我的模板。亚姆看起来像

AWSTemplateFormatVersion: '2010-09-09'

Transform: AWS::Serverless-2016-10-31

Description: >-
  A SAM CLI template for a single-endpoint Hello World Lambda function in Scala

Resources:
  HelloScalaFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: HelloScala
      Description: A simple AWS Lambda function in Scala
      Runtime: java8
      Handler: lambda.ApiGatewayProxyHandler
      CodeUri: target/scala-2.12/hello-scala.jar
      MemorySize: 512
      Timeout: 15
      Environment:
        Variables:
          env: staging
      Events:
        Hello:
          Type: Api
          Properties:
            Path: /hello/{name}
            Method: GET
        
Outputs:
    ApiURL:
      Description: "API endpoint URL for Prod environment"
      Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/{name}"

有人经历过类似的事情吗? 你将如何解决这个问题


共 (0) 个答案