JTW
JTW

Reputation: 3685

Go AWS Lambda: Where is event?

Most Lambda runtimes have the following handler signature, which allows accessing both the event and context objects passed into the Lambda:

lambdaHandler(event, context){}

However the documentation for Go Lambda handlers does not follow this convention as shown here: https://docs.aws.amazon.com/lambda/latest/dg/golang-handler.html

Question: How does one access the event object when using the Go Lambda runtime, i.e., when trying to determine the repository URL in an AWS CodeCommit Lambda Trigger (https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-notify-lambda.html)?

Upvotes: 1

Views: 608

Answers (1)

Traycho Ivanov
Traycho Ivanov

Reputation: 3207

Your expected event is of type events.CodeCommitEvent

func handler(ctx context.Context, codeEvent events.CodeCommitEvent) {
    for _, record := range codeEvent.Records {
        // do you magic here.
    }
}

Upvotes: 3

Related Questions