英文:
the default template for go lang "aws-go" in the serverless framwork isn't working
问题
大家好 我是一个新手,我在使用Serverless框架部署的预构建的aws-go模板函数时遇到了问题。
不确定是否相关,但以下是关于我的系统的一些详细信息:
-` malup@mangulangot
.o+` -----------------
`ooo/ OS: Arch Linux x86_64
`+oooo: Host: GV62 8RD REV:1.0
`+oooooo: Kernel: 6.0.12-arch1-1
-+oooooo+: Uptime: 20 hours, 51 mins
`/:-:++oooo+: Packages: 1578 (pacman)
`/++++/+++++++: Shell: zsh 5.9
`/++++++++++++++: Resolution: 1920x1200
`/+++ooooooooooooo/` DE: GNOME 43.2
./ooosssso++osssssso+` WM: Mutter
.oossssso-````/ossssss+` WM Theme: Adwaita
-osssssso. :ssssssso. Theme: Juno-v40 [GTK2/3]
:osssssss/ osssso+++. Icons: Adwaita [GTK2/3]
/ossssssss/ +ssssooo/- Terminal: kitty
`/ossssso+/:- -:/+osssso+- CPU: Intel i5-8300H (8) @ 4.000GHz
`+sso+:-` `.-/+oso: GPU: NVIDIA GeForce GTX 1050 Ti Mobile
`++:. `-/+/ GPU: Intel CoffeeLake-H GT2 [UHD Graphics 630]
.` `/ Memory: 11563MiB / 15842MiB
我有:
- Node.js:
v19.0.0
- Go:
go version go1.19.4 linux/amd64
- AWS CLI:
aws-cli/2.9.8 Python/3.9.11 Linux/6.0.12-arch1-1 exe/x86_64.arch prompt/off
- Serverless框架:
Framework Core: 3.25.1
Plugin: 6.2.2
SDK: 4.3.2
我一直收到以下错误消息:
{
"errorType": "Runtime.ExitError",
"errorMessage": "RequestId: ac441b76-f8af-4565-9d46-8d8849efdf9c Error: Runtime exited with error: exit status 1"
}
Environment: linux, node 19.0.0, framework 3.25.1, plugin 6.2.2, SDK 4.3.2
Credentials: Local, "default" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Invoked function failed
以下是我部署函数的确切步骤:
- 在AWS控制台UI中使用“访问密钥 - 编程访问”作为凭证类型创建了一个IAM用户
- 点击“直接附加现有策略”并选中“AdministratorAcess”框,完成用户创建
- 运行
aws configure
并输入:AWS Access Key ID
AWS Secret Access Key
- 为区域输入
us-east-1
- 为输出格式输入
json
- 运行
serverless create -t aws-go -p backend
创建名为backend
的项目结构 cd backend
- 运行
go mod init backend
创建mod文件 - 运行
go mod tidy
解决依赖关系 - 运行
make
- 运行
serverless deploy
没有发生错误,一切似乎都很正常。
现在我运行serverless invoke -f hello
,然后我得到了那个错误消息。
如果我从AWS Lambda控制台点击“测试”按钮来测试该函数,它也会失败,并显示以下日志消息:
/var/task/bin/hello: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by /var/task/bin/hello)
/var/task/bin/hello: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /var/task/bin/hello)
2022/12/17 21:44:41 exit status 1
/var/task/bin/hello: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by /var/task/bin/hello)
/var/task/bin/hello: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /var/task/bin/hello)
2022/12/17 21:44:41 exit status 1
START RequestId: bdc3fd91-c5a8-4427-ab84-2eebba760853 Version: $LATEST
RequestId: bdc3fd91-c5a8-4427-ab84-2eebba760853 Error: Runtime exited with error: exit status 1
Runtime.ExitError
END RequestId: bdc3fd91-c5a8-4427-ab84-2eebba760853
请问我该如何解决这个问题?请帮帮我
英文:
hello everyone noob here, I am having trouble invoking pre-built aws-go template function that i have deployed using the serverless framework.
not sure if it's relevant but here some details about my system
-` malup@mangulangot
.o+` -----------------
`ooo/ OS: Arch Linux x86_64
`+oooo: Host: GV62 8RD REV:1.0
`+oooooo: Kernel: 6.0.12-arch1-1
-+oooooo+: Uptime: 20 hours, 51 mins
`/:-:++oooo+: Packages: 1578 (pacman)
`/++++/+++++++: Shell: zsh 5.9
`/++++++++++++++: Resolution: 1920x1200
`/+++ooooooooooooo/` DE: GNOME 43.2
./ooosssso++osssssso+` WM: Mutter
.oossssso-````/ossssss+` WM Theme: Adwaita
-osssssso. :ssssssso. Theme: Juno-v40 [GTK2/3]
:osssssss/ osssso+++. Icons: Adwaita [GTK2/3]
/ossssssss/ +ssssooo/- Terminal: kitty
`/ossssso+/:- -:/+osssso+- CPU: Intel i5-8300H (8) @ 4.000GHz
`+sso+:-` `.-/+oso: GPU: NVIDIA GeForce GTX 1050 Ti Mobile
`++:. `-/+/ GPU: Intel CoffeeLake-H GT2 [UHD Graphics 630]
.` `/ Memory: 11563MiB / 15842MiB
i have
- Nodejs:
v19.0.0
- Go:
go version go1.19.4 linux/amd64
- aws cli:
aws-cli/2.9.8 Python/3.9.11 Linux/6.0.12-arch1-1 exe/x86_64.arch prompt/off
- serverless framework:
Framework Core: 3.25.1
Plugin: 6.2.2
SDK: 4.3.2
i keep getting this error message
{
"errorType": "Runtime.ExitError",
"errorMessage": "RequestId: ac441b76-f8af-4565-9d46-8d8849efdf9c Error: Runtime exited with error: exit status 1"
}
Environment: linux, node 19.0.0, framework 3.25.1, plugin 6.2.2, SDK 4.3.2
Credentials: Local, "default" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Invoked function failed
here are the exact steps i have taken to deploy the function/s,
- created an IAM user name in aws console ui in the browser with
Access key - Programmatic access
as credential type - clicked on
Attach existing policies directly
and checked the box forAdministratorAcess
and finished creating the user - ran
aws configure
and entered theAWS Access Key ID
AWS Secret Access Key
- entered
us-east-1
for the region - and entered
json
for the output format
- ran
serverless create -t aws-go -p backend
to create a project structure calledbackend
cd backend
go mod init backend
to create the mod filego mod tidy
to resolve dependenciesmake
serverless deploy
no errors have occurred and everything seemed fine.
now i run serverless invoke -f hello
and i get that error message
if i click on the Test
button from the aws lambda console for the function it also fails with this is as the log message
/var/task/bin/hello: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by /var/task/bin/hello)
/var/task/bin/hello: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /var/task/bin/hello)
2022/12/17 21:44:41 exit status 1
/var/task/bin/hello: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by /var/task/bin/hello)
/var/task/bin/hello: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /var/task/bin/hello)
2022/12/17 21:44:41 exit status 1
START RequestId: bdc3fd91-c5a8-4427-ab84-2eebba760853 Version: $LATEST
RequestId: bdc3fd91-c5a8-4427-ab84-2eebba760853 Error: Runtime exited with error: exit status 1
Runtime.ExitError
END RequestId: bdc3fd91-c5a8-4427-ab84-2eebba760853
how do i go about resolving this issue please help
答案1
得分: 1
根据这个论坛上的指示,通过更改makefile文件解决了问题。
build:
env CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o bin/hello hello/main.go
env CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o bin/world world/main.go
英文:
solved by changing the make file according to the instructions on this forum
https://forum.serverless.com/t/hello-world-results-in-internal-server-error/13447
build:
env CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o bin/hello hello/main.go
env CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o bin/world world/main.go
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论