Unable to invoke Go Lambda on arm64


I am trying to start a lambda which is being invoked by an SQS message. The lambda is build with the following command within the init and is based on Go
awslocal --region=us-east-1 --endpoint-url=http://localhost:4566 lambda create-function --function-name deployments-lambda-sandbox-serverless --runtime go1.x --role arn:aws:iam::000000000000:role/deployments-lambda-sandbox-serverless-role --handler main --architectures arm64 --zip-file fileb:///opt/code/localstack/lambdas/deployments-lambda-sandbox-serverless.zip

This creates all fine with the Go binary in a zip file.

However when invoked i get the following error and I am wondering what I have done wrong since I thought arm64 support was added some time ago?

docker.errors.ImageNotFound: 404 Client Error for http+docker://localhost/v1.43/containers/create?name=generated-localdev-localstack-1-lambda-deployments-lambda-sandbox-serverless-251359e27f1bfa609ce73fafed9142cd&platform=linux%2Farm64: Not Found ("image with reference public.ecr.aws/lambda/go:1 was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64")
localstack-1                         | 
localstack-1                         | During handling of the above exception, another exception occurred:
localstack-1                         | 
localstack-1                         | Traceback (most recent call last):

I am running a macbook pro m2 for reference.

my docker compose snippet for localstack:

    image: localstack/localstack
      - "4566-4597:4566-4597"
      - SERVICES=sqs,sns,lambda,cloudwatch,logs,kms,ses
      - DEBUG=0
      - DATA_DIR=/tmp/localstack/data
      - ./localstack-init.sh:/etc/localstack/init/ready.d/init-aws.sh
      - ./lambdas:/opt/code/localstack/lambdas
      - ./volume:/var/lib/localstack"
      -  "/var/run/docker.sock:/var/run/docker.sock"
      - localstack
      driver: "json-file"
        max-size: "10m"
        max-file: "3"
    privileged: true

Thank you,

The reason behind this is rather simple - The go1.x runtime is only available on x86_64, not on ARM.

The error message is a bit misleading, but the error would be the same on AWS - it is not available. You can see this here: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html

I would suggest using the provided.al2 or provided.al2023 image for your go lambda - as the go1.x runtime is will be deprecated on AWS in january.
If you want to use go1.x, you need to specify the x86_64 architecture - this should work fine on your Mac.

thank you very much, this worked… silly me not keeping up to date

Additionally for anyone using Go and will come onto my next issue:
make sure you build as bootstrap and set the handler to bootstrap.