I don’t see anything in the example to indicate that the closure pattern for Swift Lambda handlers actually allows true async.
func lambdaHandler(event: Event, context: Context) {
// your lambda handler logic...
}
What’s wrong with this approach, which is how lambda handlers are written in every other language with the exception of JavaScript - let’s not pretend that JavaScript is a good language design reference.
Look at this Go example In comparison... simple, readable, intuitive:
package main
import (
"fmt"
"context"
"github.com/aws/aws-lambda-go/lambda"
)
type MyEvent struct {
Name string `json:"name"`
}
func HandleRequest(ctx context.Context, name MyEvent) (string, error) {
return fmt.Sprintf("Hello %s!", name.Name ), nil
}
func main() {
lambda.Start(HandleRequest)
}