Skip to content

Commit

Permalink
Merge 9df4e76 into 39700b5
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyzhao2018 authored Apr 4, 2024
2 parents 39700b5 + 9df4e76 commit 69547b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
14 changes: 10 additions & 4 deletions internal/wrapper/wrap_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"encoding/json"
"errors"
"fmt"

"github.com/DataDog/datadog-lambda-go/internal/extension"
"github.com/DataDog/datadog-lambda-go/internal/logger"
"github.com/aws/aws-lambda-go/lambda"
Expand Down Expand Up @@ -134,6 +133,16 @@ func validateHandler(handler interface{}) error {
}

func callHandler(ctx context.Context, msg json.RawMessage, handler interface{}) (interface{}, error) {
var response interface{}
var errResponse error
defer func() {
if r := recover(); r != nil {
fmt.Println(r)
response = nil
errResponse = fmt.Errorf("recovered from: %v", r)
}
}()

ev, err := unmarshalEventForHandler(msg, handler)
if err != nil {
return nil, err
Expand All @@ -160,9 +169,6 @@ func callHandler(ctx context.Context, msg json.RawMessage, handler interface{})
handlerValue := reflect.ValueOf(handler)
output := handlerValue.Call(args)

var response interface{}
var errResponse error

if len(output) > 0 {
// If there are any output values, the last should always be an error
val := output[len(output)-1].Interface()
Expand Down
6 changes: 3 additions & 3 deletions tests/integration_tests/hello/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ toolchain go1.21.5
require (
github.com/DataDog/datadog-lambda-go v1.14.0
github.com/aws/aws-lambda-go v1.46.0
gopkg.in/DataDog/dd-trace-go.v1 v1.60.0
gopkg.in/DataDog/dd-trace-go.v1 v1.60.3
)

require (
github.com/DataDog/appsec-internal-go v1.4.0 // indirect
github.com/DataDog/appsec-internal-go v1.4.1 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.50.2 // indirect
github.com/DataDog/datadog-go/v5 v5.5.0 // indirect
Expand Down Expand Up @@ -67,7 +67,7 @@ require (
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a // indirect
)

Expand Down
3 changes: 3 additions & 0 deletions tests/integration_tests/hello/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ github.com/DataDog/appsec-internal-go v1.0.2 h1:Z+YWPlkQN+324zIk+BzKlPA1/6guKgGm
github.com/DataDog/appsec-internal-go v1.0.2/go.mod h1:+Y+4klVWKPOnZx6XESG7QHydOaUGEXyH2j/vSg9JiNM=
github.com/DataDog/appsec-internal-go v1.4.0 h1:KFI8ElxkJOgpw+cUm9TXK/jh5EZvRaWM07sXlxGg9Ck=
github.com/DataDog/appsec-internal-go v1.4.0/go.mod h1:ONW8aV6R7Thgb4g0bB9ZQCm+oRgyz5eWiW7XoQ19wIc=
github.com/DataDog/appsec-internal-go v1.4.1/go.mod h1:rmZ+tpq5ZPKmeOUMYjWFg+q1mRd13mxZwSLBG+xa1ik=
github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 h1:bUMSNsw1iofWiju9yc1f+kBd33E3hMJtq9GuU602Iy8=
github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0/go.mod h1:HzySONXnAgSmIQfL6gOv9hWprKJkx8CicuXuUbmgWfo=
github.com/DataDog/datadog-agent/pkg/obfuscate v0.50.2 h1:y08IzbpFM/HBaKfgayFZe1FpcbZn6bVPXoZ++93vxv8=
Expand Down Expand Up @@ -316,10 +317,12 @@ google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cn
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/DataDog/dd-trace-go.v1 v1.58.0 h1:ixIUarsu0RrOt7xfdrE5YSFvjgaWsP3cC3G342jTIuw=
gopkg.in/DataDog/dd-trace-go.v1 v1.58.0/go.mod h1:SmnEjjV9ZQr4MWRSUYEpoPyNtmtRK5J6UuJdAma+Yxw=
gopkg.in/DataDog/dd-trace-go.v1 v1.60.0 h1:hjDiU6PWRgMoUeSJkXdtimUP76cFzREPIGIIQJD0mYU=
gopkg.in/DataDog/dd-trace-go.v1 v1.60.0/go.mod h1:6aArYrAHjnuaofJ3lKuSRQbhrBx1LcSpiEYCIScJE5Y=
gopkg.in/DataDog/dd-trace-go.v1 v1.60.3/go.mod h1:XF/Y0lFGnmgedNXnltCm6hXkt9iwyeVVVFbKhJvVwtY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down

0 comments on commit 69547b1

Please sign in to comment.