I’ve an existing lambda function with go1.x runtime, which working fine with sqs triggers. Trying to update the function to use new provided.al2 runtime using the instructions here.
Have updated the binary with bootstrap name, with this updated build command.
GOOS=linux GOARCH=amd64 go build -o bootstrap
After updating this new package and changing runtime, execution is always timing out in the init phase.
INIT_REPORT Init Duration: 10008.47 ms Phase: init Status: timeout
INIT_REPORT Init Duration: 60060.47 ms Phase: invoke Status: error Error Type: Runtime.Unknown
Same code works when I change binary to main and switch back to go1.x runtime.
can someone help?
Edit:
Issue is resolved after updating aws-lambda-go library to latest.
Old version is working perfectly fine with Go 1.x runtime. But to use custom amazon linux 2 runtime, had to update the library to latest version.
2
Answers
Turns out that the github.com/aws/aws-lambda-go library used in existing code is not compatible with new al2 runtime. Have updated this library to the latest version and init timeout error isssue is resolved
Could be that you forgot updating the lambda handler setting?
See „change the handler“ here: https://www.go-on-aws.com/lambda-go/lambda_function/create-console-custom/