Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS SAM CLI java8 runtime is not supported

I'm trying to build a Lambda application using AWS SAM CLI command:

sam build --template C:/MyProject/template.yaml --build-dir C:/MyProject/.aws-sam/build

but I'm getting this error:

Build Failed

Error: 'java8' runtime is not supported

This is my 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

It's an example project made in Intellij using AWS Toolkit plugin, I have installed SAM CLI version 0.9.0 and jdk1.8.0_191 (I've tried different versions but it didn't work), at the project's GitHub I can see that java 8 is supported:

[ ] Supported AWS Lambda Runtimes
    [x] java8

Why am I getting this error?

like image 379
Michael Dz Avatar asked Dec 17 '18 12:12

Michael Dz


Video Answer


1 Answers

Seems like the build option doesn't support the java8 runtime

When I run sam build --help the result is: enter image description here which implies that it only works for python

like image 132
sakata-san Avatar answered Oct 12 '22 13:10

sakata-san