[SOLVED] Golang Deploy Permission Issue

Hi there,

I have just started using Serverless (v1.47.0) and am having trouble with the Golang examples on Windows 10.

I am getting this error from when I invoke the deployed hello and world functions from the default Go files created by serverless.

{                                                                      
    "errorMessage": "fork/exec /var/task/bin/hello: permission denied",
    "errorType": "PathError"                                           
}

I believe I am facing an issue that was supposedly fixed quite awhile ago as shown here:

And fixed here:

If I open the uploaded zip in 7zip, the permissions for both compiled go files are -rw-rw-rw- so not executable?

Hopefully I’ve just missed something obvious but following the example instructions just doesn’t work for me.

So I worked around the issue and got it working! :partying_face:

I feel like this should be much smoother OOTB so please let me know if I’ve missed something obvious.

Here is what I did to get the functions uploading with executable permissions.

Install build-lambda-zip

go.exe get -u github.com/aws/aws-lambda-go/cmd/build-lambda-zip

makefile

.PHONY: build clean deploy

build:
	dep ensure -v
	env GOOS=linux go build -ldflags="-s -w" -o bin/hello hello/main.go
	env GOOS=linux go build -ldflags="-s -w" -o bin/world world/main.go
	${GOPATH}\bin\build-lambda-zip.exe -o bin/hello.zip bin/hello
	${GOPATH}\bin\build-lambda-zip.exe -o bin/world.zip bin/world

clean:
	rm -rf ./bin ./vendor Gopkg.lock

deploy: clean build
	sls deploy --verbose

serverless.yml

frameworkVersion: '>=1.28.0 <2.0.0'

provider:
  name: aws
  runtime: go1.x

package:
  individually: true

functions:
  hello:
    handler: hello
    events:
      - http:
          path: hello
          method: get
    package:
      artifact: bin/hello.zip
  world:
    handler: world
    events:
      - http:
          path: world
          method: get
    package:
      artifact: bin/world.zip