When deploying this Go-based AWS Lambda project, via AWS console, I receive:
{
"errorMessage": "fork/exec /var/task/main: exec format error",
"errorType": "PathError"
}
Here are the steps I took:
marriage-master
project from Gitgo get "github.com/aws/aws-lambda-go/lambda"
so the script is buildable by Gogo build main.go
to create file Lambda will use to executezip main.zip main
to archive the file into a .zip for deployment to Lambdamain.zip
to Function code
Handler
to main
.But I keep getting this path error. Any idea what I'm doing wrong?
To deploy a Go app in AWS Lambda, run the following commands:
Build the binary targeted to Linux OS and amd64 architecture
GOARCH=amd64 GOOS=linux go build main.go -ldflags="-s -w"
Zip the binary
zip lambda.zip main
Upload this binary from AWS Lambda console directly or Put it in an S3 bucket and import it.
You have taken care of the lambda configuration already.
Try without flags:
GOARCH=amd64 GOOS=linux go build main.go
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With