I have developed a set of Lambda functions in Golang and trying to deploy these functions and API gateway using SAM.
I am creating the executables locally, creating zip file for each of these lambda functions and and uploading these zip files to s3 bucket.
I am giving the reference of this S3 bucket in the SAM template file.
My SAM template file looks as below
myfunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://<<my-bucket>>/bin/handlers/myfunction.zip
Handler: myfunction
Role: !GetAtt CFLambdaExecutionRole.Arn
Events:
Getcfdemoapi:
Type: Api
Properties:
Path: /myfunction
Method: get
CreateCustomer:
Type: Api
Properties:
Path: /myfunction
Method: post
UpdateCustomer:
Type: Api
Properties:
Path: /customer
Method: put
DeleteCustomer:
Type: Api
Properties:
Path: /myfunction
Method: delete
The deployment was successful.
I invoked the lambda function through API gateway.
I checked the Cloud watch log and saw below error -
Error fork/exec /var/task/myfunction : no such file or directory: PathError
Is there anything wrong in the SAM template, related to CodeUri and handler?
I am creating the build on MacOS and using the below command for build -
GOOS=linux GOARCH=amd64 go build
myfunction.zip
? – Cutshall