-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fork/exec /var/task/main: permission denied #274
Comments
Do you have a built binary called main in your directory when you run the package command? Are you using Linux/Mac or Windows? The built binary needs to have execute permissions. |
Yes, built using |
I downloaded the file that was packaged to S3 and it has different permission. |
Here is a nifty little tool to zip up properly: https://github.com/aws/aws-lambda-go#for-developers-on-windows |
When I set the |
Hey @terrywarwar @PaulMaddox I have a similar situation but I get:
when I run Handler is set to I think my problem is similar, but I hope to get to the permission problem :) |
@neoadventist have you done a build using |
@terrywarwar yes |
I had the same issue using
|
Not sure if this is the case here, but I found this issues page while debugging the The issue was that I'd neglected to create a main function and my go package name wasn't main.
|
Created PR, aws/aws-cli#3112 |
@neoadventist, did you find solution for your problem? I have the same issue. |
@charger88 nah, still the same issue. My code seem to work okay on my mac vs the linux/WSL environment, so i'm using that. (plus the whole lambda experiment was put on hold for now) please be sure to comment here when you've solved it! |
@neoadventist I just forgot about building step. |
It seems like this issue persists due to file permissions specified by @terrywarwar and the missing argument specified by @charger88.
and Read, Write, Execute permissions instead of simply Read or Write permissions. This solves the problem issued here, but does anyone know why this failure occurs? |
If anyone got here seeing the same error @neoadventist had
Also make sure that your are building on glibc if you are using os, runtime or net. This could be relevant if you were building on This case you can also try to link your libs statically instead of dynamically. This worked for me to build on alpine and run on aws.
|
what was the actual fix for this? I'm using windows and running this:
and my function looks like this:
|
Just leaving this here for anyone who happens to stumble across this: My zip file had some of my full build path in it from my Makefile. I needed to add build:
${GOBUILD} -ldflags="-d -s -w" -o ${BINPATH}/hello ./cmd/hello/main.go
chmod +x ${BINPATH}/hello
zip -j ${BINPATH}/hello.zip ${BINPATH}/hello This works when the Lambda handler is specified as |
@mikeatlas That worked for me! I just added the |
You should find this path manually, this error is simple, only to find path. |
If you are still having this problem, see my case
|
for me it was literally just the...
thanks mate! |
@maddinek , Where did you add this ? I am using AWS SAM hello-world application and getting. {"errorType":"exitError","errorMessage":"RequestId: 09bda008-f1ba-1f08-63cd-c9df843425e3 Error: fork/exec /var/task/hello-world: permission denied"} . Any idea on this . |
@jkrnak . Hey. I am also facing same issue. I did not understand what did you said. |
@EdisonGonzalez , Hey , Even I am facing the permission denied issue. |
I am able to create the zip and upload manually through the AWS console to get the Lambda function working. However, how would one do this using sam package + sam deploy? Update |
I successfully deployed a golang lambda api service using
sam package
andsam deploy
.And when I test the lambda function, I get the error below.
{ "errorMessage": "fork/exec /var/task/main: permission denied", "errorType": "PathError" }
The text was updated successfully, but these errors were encountered: