aws-lambda - AWS Lambda Go : The VM errors out in

我创建了一个“hellologo”lambda,并尝试使用

在本地运行它

山姆包 山姆部署 sam local start-api 访问:http://localhost:3000/hellogo

docker 在首选项中共享了 hellogo 文件夹。

访问时我看到来自 docker 的以下错误,我需要做什么来解决这个问题?

Fetching lambci/lambda:go1.x Docker container image......
2019-01-12 21:53:42 Mounting /Volumes/data/temp/aws-lambda-go-hello as /var/task:ro inside runtime container
START RequestId: 20099bdb-175d-10b0-c6dd-8acecddd82cd Version: $LATEST
END RequestId: 20099bdb-175d-10b0-c6dd-8acecddd82cd
REPORT RequestId: 20099bdb-175d-10b0-c6dd-8acecddd82cd  Duration: 1.26 ms   Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 6 MB   
{
  "errorMessage": "fork/exec /var/task/main: no such file or directory",
  "errorType": "PathError"
}
2019-01-12 21:53:43 Function returned an invalid response (must include one of: body, headers or statusCode in the response object). Response received: 
2019-01-12 21:53:43 127.0.0.1 - - [12/Jan/2019 21:53:43] "GET /hellogo HTTP/1.1" 502 -
2019-01-12 21:53:43 127.0.0.1 - - [12/Jan/2019 21:53:43] "GET /favicon.ico HTTP/1.1" 403 -

更多详情:

山姆包

ML02:aws-lambda-go-hello pro$  **sam package** --template-file template.yaml --output-template-file packaged.yaml --s3-bucket prembucket01
Uploading to 60c9406899556856b732b3b1d556f0c2  1608 / 1608.0  (100.00%)
Successfully packaged artifacts and wrote output template to file packaged.yaml.

山姆部署

ML02:aws-lambda-go-hello pro$  sam deploy --template-file packaged.yaml --stack-name aws-serverless-application --capabilities CAPABILITY_IAM

Waiting for changeset to be created..
Waiting for stack create/update to complete
Successfully created/updated stack - aws-serverless-application

sam 本地启动 api

ML02:aws-lambda-go-hello pro$ sam local start-api
2019-01-12 21:51:10 Found credentials in shared credentials file: ~/.aws/credentials
2019-01-12 21:51:11 Mounting helloworld at http://127.0.0.1:3000/hellogo [GET]
2019-01-12 21:51:11 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2019-01-12 21:51:11  * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)

我在 aws 中部署时看到同样的错误

最佳答案

还有一些相关的问题比如

Deploying AWS Lambda with Go & Cloudformation和

https://github.com/serverless/serverless/issues/4710

试着做一个像这样的处理程序

func main() {
    lambda.Start(helloGoHandler)
}

关于aws-lambda - AWS Lambda Go : The VM errors out in mounting the folder,/var/task/main 没有这样的文件或目录。如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54165737/

相关文章:

apache-spark - 我的 SparkSession 初始化需要很长时间才能在我的笔记本电脑

reactjs - 从 DateInput BlueprintJS 更改月份名称

css - VS Code 中的“导航到声明/实现”

flutter - 为什么 build() 在后台的屏幕上被多次调用?

node.js - 为什么作为响应 SIGINT 信号的回调调用的方法在进程终止之前没有完全完成?

angular - NRWL 中的多个应用程序可以访问定义文件的位置

laravel - Vue 多选 laravel 提交表单

android - Cordova 插件文件路径 : Unable to resolve files

android - 获取/返回由 Android Room 数据库生成的自动生成的 ID(作为主键)

python - 需要帮助来模拟 xhr 请求