From 76660fc4d56878cd74b96f7a010d3437fabfc1c4 Mon Sep 17 00:00:00 2001 From: Carl Zogheib Date: Wed, 8 Dec 2021 12:30:08 +0000 Subject: [PATCH] Log function error on failure --- lambda/invoke_loop.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lambda/invoke_loop.go b/lambda/invoke_loop.go index f2843ded..f9f7005a 100644 --- a/lambda/invoke_loop.go +++ b/lambda/invoke_loop.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "log" "strconv" "time" @@ -47,8 +48,9 @@ func handleInvoke(invoke *invoke, function *Function) error { } if functionResponse.Error != nil { - payload := safeMarshal(functionResponse.Error) - if err := invoke.failure(payload, contentTypeJSON); err != nil { + errorPayload := safeMarshal(functionResponse.Error) + log.Printf("%s", errorPayload) + if err := invoke.failure(errorPayload, contentTypeJSON); err != nil { return fmt.Errorf("unexpected error occurred when sending the function error to the API: %v", err) } if functionResponse.Error.ShouldExit {