After deploying the Go Hello World quickstart example (without any modifications), the deployed Lambda fails to run, with a file not found error.
sam init --runtime go1.xHello World Examplemake the project (or sam build)sam deploy --guidedThe following error is visible in the Lambda console:
{
"errorMessage": "fork/exec /var/task/hello-world: no such file or directory",
"errorType": "PathError"
}
The Lambda executes.
sam --version: SAM CLI, version 1.0.0go version: go version go1.14.5 linux/amd64This also occurs with the following environment details:
sam --version: SAM CLI, version 1.0.0go version: go1.14.6 windows/amd64Seems to be related to executable permissions:
ls .aws-sam/build/HelloWorldFunction
Directory: ~\source\foo\.aws-sam\build\HelloWorldFunction
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 8/6/2020 10:29 AM 9967550 hello-world
However, this works as expected on macOS with the following environment details:
sam --version: SAM CLI, version 1.0.0go version: go1.14.6 darwin/amd64This also occurs with the following environment details:
- OS: Windows 10, Version 1809 (OS Build 17763.1339)
sam --version: SAM CLI, version 1.0.0go version: go1.14.6 windows/amd64Seems to be related to executable permissions:
ls .aws-sam/build/HelloWorldFunction Directory: ~\source\foo\.aws-sam\build\HelloWorldFunction Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 8/6/2020 10:29 AM 9967550 hello-world
Duplicate with: https://github.com/awslabs/aws-sam-cli/issues/954
Original issue could a different one since the error message is path not found and I wasn't able to reproduce it yet.
Having the same issue, is there a workaround?
One workaround is to provision a Cloud9 instance. I just tested this with the default install and everything works as expected. The smallest instance type _t2.micro_ should be fine, and may fall within the free tier depending on your account age and usage. See Cloud9 Pricing for more information.
NOTE: You must choose "Amazon Linux" as the Platform, not Ubuntu Server 18.04 LTS. It does not work on Ubuntu Server 18.04 LTS.
Working Cloud9 info:
sam --version: SAM CLI, version 1.3.2go version: go1.13.14 linux/amd64One workaround is to provision a Cloud9 instance. I just tested this with the default install and everything works as expected. The smallest instance type _t2.micro_ should be fine, and may fall within the free tier depending on your account age and usage. See Cloud9 Pricing for more information.
NOTE: You must choose "Amazon Linux" as the Platform, not Ubuntu Server 18.04 LTS. It does not work on Ubuntu Server 18.04 LTS.
Working Cloud9 info:
- OS: Amazon Linux 2018.03
sam --version: SAM CLI, version 1.3.2go version: go1.13.14 linux/amd64
Thank you for the response. My issue occurred because I use gvm and I wasn't in the right path prior to compiling the project.
When I run gvm use go1. X. X then compile and deploy, the problem was solved.
I was not able to reproduce this issue. As @yogesnsamy mentioned, this could be a setup error.
Thank you for the response. My issue occurred because I use gvm and I wasn't in the right path prior to compiling the project.
When I rungvm use go1. X. Xthen compile and deploy, the problem was solved.
Regarding the Windows permission issue @rts-rob brought up, it is tracked and fixed in a separate issue. #954
Closing this issue, feel free to reopen if anyone has more info on this matter.
Most helpful comment
This also occurs with the following environment details:
sam --version: SAM CLI, version 1.0.0go version: go1.14.6 windows/amd64Seems to be related to executable permissions: