无法部署用Go编写的lambda函数

Jus*_*tin 7 go amazon-web-services aws-lambda

我正在尝试将我的代码部署到AWS Lambda.我用Go写的.它构建得很好,但是当通过Lambda测试功能运行它时我收到此错误:

{
  "errorMessage": "fork/exec /var/task/github-activity: no such file or directory",
  "errorType": "PathError"
}
Run Code Online (Sandbox Code Playgroud)

您可以在以下网址查看完整代码:https://github.com/JustinDFuller/github-activity 我已经测试并看到它在我的机器上运行正常.(我试过Windows和Linux).

我正在部署的文件是通过运行以下命令来完成的:

GOOS=linux GOARCH=amd64 go build -o main awsLambdaImpl.go zip main.zip main

mew*_*ewa 12

Go Lambda的处理程序可执行文件路径.

由于您正在上传以下结构的zip文件

main.zip
|
`-- main  <-- executable
Run Code Online (Sandbox Code Playgroud)

您的处理程序名称必须是main.

如果你按照以下方式打包lambda,那么你的处理程序就是

main.zip
|
`-- subdir
      |
      `-- executableInASubdirPackedIntoAZip  <-- executable
Run Code Online (Sandbox Code Playgroud)

那么你的处理程序就是subdir/executableInASubdirPackedIntoAZip.