Reputation: 443
I migrated aws-sdk-go-v2 to v0.31.0 from v0.25.0.
My code is a bit of a Frankenstein's Monster and I want to fully migrate to this version but I can't find the current location/approach for some features.
Specifically:
I had:
func HandleRequest(ctx context.Context, event events.APIGatewayV2HTTPRequest) (string, error) {}
The relevant import was "github.com/aws/aws-lambda-go/events". I had a rake around various service but can't locate an update, is that still correct?
Also func main() used to be:
func main() {
lambda.Start(HandleRequest)}
But no more Start() method, so what is the correct paradigm now ?
The sdk is a lot better, but I am missing the examples.
Upvotes: 4
Views: 4564
Reputation: 95
Are you importing both github.com/aws/aws-lambda-go/lambda and github.com/aws/aws-sdk-go-v2/service/lambda? If so, try importing the former with:
runtime "github.com/aws/aws-lambda-go/lambda"
And then call runtime.Start(HandleRequest)
As for handling events, see the samples in https://github.com/aws/aws-lambda-go/tree/master/events.
Upvotes: 2