Open
Description
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v18.14.0
Amplify CLI Version
11.1.1
What operating system are you using?
Windows WSL 2
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
I created a go function, then ran amplify push
to compile and create the lambda function. Everything went smoothly until the function was executed by API Gateway and failed with the error:
/var/task/main: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by /var/task/main)
Expected behavior
The API gateway should return a 200 but instead returns 502 since the lambda function fails.
Reproduction steps
create a api and lambda function with amplify add api
.
Create an api with /search
path.
create a new go function then replace the contents with 👍
package main
import (
"context"
"encoding/json"
"fmt"
// "github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/kendra"
)
type QueryRequest struct {
Search string `json:"search"`
IndexID string `json:"indexID"`
}
type QueryResponse struct {
Results *kendra.QueryOutput `json:"results`
Documents []Document `json:"documents`
Lawyers []Lawyer `json:"lawyers`
}
/
func handler(ctx context.Context, request QueryRequest) (QueryResponse, error) {
// print out the request
functionrequest, _ := json.Marshal(request)
println("Query Request:\n", string(functionrequest))
sess := session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
}))
svc := kendra.New(sess)
println("Started the kendra session")
// 1. Security checks for the requesting user and index
// Skipped for Now
// 2. Query the index with the search term
// Check if the specified index exists
_, err := svc.DescribeIndexWithContext(ctx, &kendra.DescribeIndexInput{
Id: &request.IndexID,
})
if err != nil {
return QueryResponse{}, fmt.Errorf("failed to describe index %s: %v", request.IndexID, err)
}
println("Index exists")
input := &kendra.QueryInput{
QueryText: &request.Search,
IndexId: &request.IndexID,
}
kendraResp, err := svc.QueryWithContext(ctx, input)
if err != nil {
return QueryResponse{}, fmt.Errorf("failed to query index %s: %v", request.IndexID, err)
}
KendraJson, _ := json.Marshal(kendraResp)
println("Query successful:\n", string(KendraJson))
return QueryResponse {}
- run
amplify push
This will cause the error.
However, I also have CICD setup with a github repo with the following build settings:
version: 1
backend:
phases:
preBuild:
commands:
- yum install golang -y
- mkdir ~/go_proj
- export PATH=$PATH:/usr/local/go/bin
- export GOPATH=$HOME/go_proj
- export GOBIN=$GOPATH/bin
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
when I run git push
, and the CICD build starts, the error caused by amplify push
from my local machine is fixed
Project Identifier
b2a8e45f990b09821ed3bcbcf1838fbc
Log output
# Put your logs below this line
Additional information
No response
Before submitting, please confirm:
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.