我正在尝试使用 AWS SAM CLI
命令构建 Lambda 应用程序:
sam build --template C:/MyProject/template.yaml --build-dir C:/MyProject/.aws-sam/build
但是我收到了这个错误:
Build Failed
Error: 'java8' runtime is not supported
这是我的template.yaml
:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
AWS Serverless Application
Sample SAM Template for AWS Serverless Application
Globals:
Function:
Timeout: 20
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: target/HelloWorld-1.0.jar
Handler: helloworld.App::handleRequest
Runtime: java8
Environment:
Variables:
PARAM1: VALUE
Events:
HelloWorld:
Type: Api
Properties:
Path: /hello
Method: get
这是一个使用 AWS Toolkit
插件在 Intellij
中制作的示例项目,我已经安装了 SAM CLI
版本 0.9.0
和 jdk1.8.0_191
(我试过不同的版本但没用),在项目的 GitHub我可以看到支持 java 8
:
[ ] Supported AWS Lambda Runtimes
[x] java8
为什么会出现此错误?
最佳答案
似乎 build
选项不支持 java8
运行时
当我运行 sam build --help
时,结果是:这意味着它只适用于 python
关于java - 不支持 AWS SAM CLI java8 运行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53815041/