-
Notifications
You must be signed in to change notification settings - Fork 110
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
IMAGE Launch error: fork/exec /lambda-entrypoint.sh: exec format error on public.ecr.aws/lambda/python:3.8 #26
Comments
I've checked it more. I'm using CDK to deploy my lambda container, and I deployed at ap-northeast-2 which is not seemed to support arm based lambda runtime. |
I've tested it more. |
We have the same issue with nodejs |
interesting, my lambda node container works well. only lambda python container has a problem.. |
EDIT: Never mind, read too fast, sorry for the noise! |
I can see the same error with "arm64" architecture. It works with the default "x86_64" type |
If I understand you correctly, you could either set the lambda architecture to Arm64 in function props or make sure that your docker is building a x86_64. If you're building on a Mac M1 then i guess it will pull and build an arm64 image.
Depending on how you specify the image, i think there are also options to set the platform directly in the CDK construct. |
I have the same issue with M1 MacOS deployment. Same deployment works fine via Windows or Linux. Since I build the container image separately in CDK as shown below. I did two things to make it work: 1) add build args in the aws_ecr_assets.DockerImageAsset(
self, self._map_id("infra-runtime"), directory="./handlers", build_args={"--platform": "linux/amd64"}
) FROM public.ecr.aws/lambda/python:3.8.2021.12.18.01-x86_64
COPY . . Afterwards, I use |
I experienced the similar problem, here is my configuration
ERROR
|
I am trying to deploy from with the help of Serverless Framework and running it from a Gitlab job, the deploy is successful but when I run the lambda I get the same error:
And the config of Dockerfile
|
I had the same issue, try tu build the docker image with |
juan-pascale's fix worked for me, easy peasy, just add |
arm and amd is different platform |
I can confirm. Building a container on an ARM Mac Mini resulted in this error. It worked fine on my laptop which has ubuntu and a non-arm architecture. I only ever ran into this issue when switching to the computer with an arm processor. |
This is still recurring regardless of the runtime. I have found it with node, python and jvm. I should be possible to specify on a serverless config which arch you're building with EDIT:
|
I ran into this but I solved it by adding a Python shebang to my app like For reference I saw this used here: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-create-from-alt Which is odd because I am using |
If someone is working with AWS CDK and deploying their code using const fakeFunction = new aws_lambda.DockerImageFunction(this, 'FakerFunction', {
code: aws_lambda.DockerImageCode.fromImageAsset(
path.join(__dirname, '..', '..', 'functions', 'fakedata'),
{
platform: Platform.LINUX_AMD64
}
),
}); |
Hello, I got a similar issue recently and I fixed it by checking the lambda architecture: in my case, the docker image was built on ARM, though lambda was set to x86_64, you can verify using the CLI command aws_lambda.DockerImageFunction(self, "MyMSKFunction",
code=aws_lambda.DockerImageCode.from_image_asset(path.join(path.dirname("."), "app")),
vpc=vpc,
architecture=aws_lambda.Architecture.ARM_64
)
|
On my M1 MacBook Pro, all I needed was this in my Dockerfile:
I had no need for DockerImageAsset. |
The solution from @little-eyes worked for me, using I recently upgraded to Python3.10 and used The solution for me was to recorrect for the M1 vs x86 architecture: The list of available ecr images is here. |
You need to force the PLATFORM as mentioned above
|
Any solutions other than forcing a different platform? I'm seeing this with v. 0.7.1 |
this works! here are some pointers: basically, you need to ensure that your built image, which is from your local machine, should have the same architecture as Lambda, since they should be the same; it happens to me before when I using github actions for CICD; where you should use cross-platform builds |
I am getting this error while testing my Lambda Function on AWS , this is my Docker File. Help me out in this error , I AM STUCK Use AWS Lambda Python base imageFROM public.ecr.aws/lambda/python:3.11 Install system dependencies for FAISSRUN yum install -y libgomp Set working directoryWORKDIR /var/task Copy application filesCOPY . . Install Python dependenciesRUN pip install -r requirements.txt --target "${LAMBDA_TASK_ROOT}" Set environment variables (replace with your actual values)ENV GOOGLE_API_KEY=your_google_api_key Expose port (for local testing)EXPOSE 8000 Command for Lambda executionCMD ["app.handler"] |
I used public.ecr.aws/lambda/python:3.8 for my python runtime on lambda.
But today I found my lambda runtime doesn't work with below error message.
IMAGE Launch error: fork/exec /lambda-entrypoint.sh: exec format error
Entrypoint: [/lambda-entrypoint.sh] Cmd: [handler.lambda_handler] WorkingDir: [/var/task]
My code was working before this commit (97a295c)
But after applying this commit, my code doesn't work anymore.
Please check this out..
The text was updated successfully, but these errors were encountered: