- Le plus récent
- Le plus de votes
- La plupart des commentaires
I figured this out. I want more control over things so I'm using this:
func HandleRequest(ctx context.Context, request events.APIGatewayV2HTTPRequest) (events.APIGatewayV2HTTPResponse, error) { ... }
which works great. It was kind of nice before that it would take care of marshaling/unmarshaling and now I have to do it myself, but that's not bad. I do kind of wish the Response "Body" was just interface{} and that it would automatically marshal/unmarshal based on Content-Type but it's fine.
One thing I do miss from doing this in Kotlin and Spring is the ability to just throw an Exception, and write an ExceptionMapper that would set the appropriate http status code.
répondu il y a 4 ans
I tried following
package main import ( "fmt" "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" ) func handler(event events.CognitoEventUserPoolsPostAuthentication) (events.CognitoEventUserPoolsPostAuthentication, error) { fmt.Printf("PreAuthentication of user: %s\n", event.UserName) // Return to Amazon Cognito return event, nil // Try raising an error // return event, fmt.Errorf("TESTING LAMBDA ERRORS WITH GOLANG") } func main() { lambda.Start(handler) }
répondu il y a 4 ans
Contenus pertinents
demandé il y a 3 ans
demandé il y a 2 ans
demandé il y a 3 ans
demandé il y a 2 ans
- AWS OFFICIELA mis à jour il y a 4 ans
- AWS OFFICIELA mis à jour il y a 4 ans
