Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jgcrunden opened this issue Feb 26, 2021 · 1 comment
Labels

Comments

@jgcrunden
Copy link

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

  • ask-cli version: 2.22.4
  • Operating System and version: Arch Linux ARMv7
  • Node.js version used for development: v15.10.0
  • NPM version used for development: 6.14.11
@doiron doiron added the Bug label Apr 28, 2022
@CamdenFoucht
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants