Home > Backend Development > Golang > Lambda custom al2 runtime with golang, initialization phase timeout

Lambda custom al2 runtime with golang, initialization phase timeout

王林
Release: 2024-02-05 22:39:04
forward
1217 people have browsed it

带有 golang 的 Lambda 自定义 al2 运行时,初始化阶段超时

Question content

I have an existing lambda function with go1.x runtime that works fine with sqs triggers. Try updating the function to use the new provided.al2 runtime as described here.

https://aws.amazon.com/blogs/compute/migration-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2 /

Binaries with the bootstrap name have been updated with this updated build command. GOOS=linux GOARCH=amd64 go build -o bootstrap

After updating this new package and changing the runtime, the execution always times out during the initialization phase.

INIT_REPORT Initialization duration: 10008.47 ms Phase: init Status: timeout

INIT_REPORT Initialization Duration: 60060.47 ms Phase: Calling Status: Error Error Type: Runtime.Unknown

The same code works when I change the binary to main and switch back to go1.x runtime. Can anyone help?

edit:

The problem has been solved after updating the aws-lambda-go library to the latest version.

The old version runs very well with Go 1.x. But to use a custom Amazon Linux 2 runtime, you must update the libraries to the latest version.


Correct answer


It turns out that the github.com/aws/aws-lambda-go library used in the existing code is not compatible with the new al2 runtime. This library has been updated to the latest version and the initialization timeout error issue has been resolved

The above is the detailed content of Lambda custom al2 runtime with golang, initialization phase timeout. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template