-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description:
Related to: #5280 building a template containing a SAM go function still doesn't seem to work.
Steps to reproduce:
Boostrap handler
Function resource following the format from: https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2/:
Function:
Type: AWS::Serverless::Function
Properties:
FunctionName: MyFunction
CodeUri: cmd/func
Timeout: 30
Handler: bootstrap
Runtime: provided.al2023
Architectures:
- x86_64
Metadata:
BuildMethod: go1.xStill gives the error message:
aws_lambda_builders.exceptions.WorkflowFailedError: GoModulesBuilder:Build - Builder Failed: go: go.mod file not found in current directory or any parent directory; see 'go help modules'
Standard handler
Changing the template resource to:
Function:
Type: AWS::Serverless::Function
Properties:
FunctionName: MyFunction
CodeUri: .
Timeout: 30
Handler: cmd/func
Runtime: provided.al2023
Architectures:
- x86_64
Metadata:
BuildMethod: go1.xInstead gives a lot of errors about git not being present in path, for example:
git init --bare in /root/go/pkg/mod/cache/vcs/0a897d51bfc9ae666ee1454be13381a5c8df2e3bb2a5bd1dba78528978aa3b56: exec: "git": executable file not found in $PATH
Expected result:
Sam build manages to build the go inside a container without any issues
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Ubuntu 20.04.6 LTS
sam --version:SAM CLI, version 1.108.0- AWS region: eu-west-1
Paste the output of sam --info here
{
"version": "1.108.0",
"system": {
"python": "3.9.18",
"os": "Linux-5.14.0-1055-oem-x86_64-with-glibc2.31"
},
"additional_dependencies": {
"docker_engine": "24.0.7",
"aws_cdk": "2.93.0 (build 724bd01)",
"terraform": "1.3.7"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}