alexa / ask-cli

Alexa Skills Kit Command Line Interface
https://developer.amazon.com/en-US/docs/alexa/smapi/ask-cli-intro.html
Apache License 2.0
167 stars 54 forks source link

ask deploy, when creating the build.zip removes execute permission from lambda executable #383

Open jgcrunden opened 3 years ago

jgcrunden commented 3 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request 
[ ] Other... Please describe: 

Expected Behavior

When 'ask deploy' is run, the "Build Skill Code" stage should preserve permissions on golang lambda binaries

Perhaps a Golang build flow in the code-builder.js file to handle building a go lambda as part of ask deploy?

Current Behavior

I'm writing my lambda for my alexa skill in Go. I've got a Makefile with a "build" target. I run "make build" which produces an executable binary with the ./lambda directory. drwxr-xr-x 3 joshua joshua 4096 Feb 26 13:27 . drwxr-xr-x 8 joshua joshua 4096 Feb 26 13:09 .. -rw-r--r-- 1 joshua joshua 178 Feb 26 13:15 Makefile -rw-r--r-- 1 joshua joshua 110 Feb 26 11:30 go.mod -rw-r--r-- 1 joshua joshua 1620 Feb 26 11:30 go.sum -rwxr-xr-x 1 joshua joshua 7291260 Feb 26 13:16 lambda -rw-r--r-- 1 joshua joshua 166 Feb 26 11:30 main.go When I run: ask deploy I can see that as part of the deployment process, it copies the contents of the ./lambda directory to ./.ask/lambda within my git repo then zips the contents into "build.zip" and it successfully deploys it to S3 for upload to lambda. However, when I try to invoke the lambda within the AWS lambda console I get the following error: fork/exec /var/task/bin/lambda: permission denied: PathError When I unzip the build.zip file and check the permissions on the lambda binary they've changed to 644 -rw-r--r-- 1 joshua joshua 7291260 Feb 1 1990 lambda

Steps to Reproduce (for bugs)

use ask new to generate a new alexa skill set runtime to go1.x in the ask-resources.json create a main.go file for lambda code run the following to compile GOARCH=amd64 GOOS=linux go build -o lambda main.go run ask deploy inspect permissions on the build.zip generated in ./.ask/lambda build the ask cli

Possible Solution

Not sure if it's a bug, or just that golang lambdas are not supposed with ask cli?

Your Environment and Context

CamdenFoucht commented 2 years ago

@jgcrunden Thank you for the bug report. We will take a look to see why this is happening.