aws / aws-lambda-go

Libraries, samples and tools to help Go developers develop AWS Lambda functions.
Apache License 2.0
3.64k stars 554 forks source link

Runtime.InvalidEntrypoint #554

Closed LiamDotPro closed 8 months ago

LiamDotPro commented 8 months ago

Hello,

I'm trying to get started with this package and I'm running into this error:

INIT_REPORT Init Duration: 1.80 ms  Phase: invoke   Status: error   Error Type: Runtime.InvalidEntrypoint
START RequestId: d515bace-9d56-4982-bd7c-0b5d3dfdd550 Version: $LATEST
RequestId: d515bace-9d56-4982-bd7c-0b5d3dfdd550 Error: fork/exec /var/task/bootstrap: exec format error
Runtime.InvalidEntrypoint
END RequestId: d515bace-9d56-4982-bd7c-0b5d3dfdd550
REPORT RequestId: d515bace-9d56-4982-bd7c-0b5d3dfdd550  Duration: 21.80 ms  Billed Duration: 22 ms  Memory Size: 128 MB Max Memory Used: 3 MB

I appreciate that this seems to be an error when trying to use Amazon Linux 2023 image and I'm using the exact same code as presented on this repo. I've to the best of my abilities tried to ensure I've complied my binary to be correct as possible (I've even installed ubuntu to ensure my windows system wasn't causing the issue). But for whatever reason I'm just running in circles contiously getting the above output from the lambda.

Here's my go program:

package main

import (
    "github.com/aws/aws-lambda-go/lambda"
)

func hello() (string, error) {
    return "Hello λ!", nil
}

func main() {
    // Make the handler available for Remote Procedure Call by AWS Lambda
    lambda.Start(hello)
}

I'm building and zipping using

GOOS=linux GOARCH=amd64 go build -o bootstrap main.go
zip lambda-handler.zip bootstrap

image

I'm simply uploading the zip created into my lambda function but with no success, I've honestly tried a lot and I'm not looking for some help as I don't seem to be able to find what I need online and I'm not sure what to try next..