@@ -13,6 +13,7 @@ import (
1313 "strconv"
1414 "strings"
1515 "time"
16+ "encoding/base64"
1617
1718 "github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda/core/statejson"
1819 "github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda/interop"
@@ -56,6 +57,7 @@ type InvokeRequest struct {
5657 InvokedFunctionArn string `json:"invoked-function-arn"`
5758 Payload string `json:"payload"`
5859 TraceId string `json:"trace-id"`
60+ ClientContext string `json:"client-context"`
5961}
6062
6163// The ErrorResponse is sent TO LocalStack when encountering an error
@@ -97,13 +99,18 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate interop.Server, logCollecto
9799 functionVersion := GetEnvOrDie ("AWS_LAMBDA_FUNCTION_VERSION" ) // default $LATEST
98100 _ , _ = fmt .Fprintf (logCollector , "START RequestId: %s Version: %s\n " , invokeR .InvokeId , functionVersion )
99101
102+ decodedClientContext ,err := base64 .StdEncoding .DecodeString (invokeR .ClientContext )
103+ if err != nil {
104+ log .Error (err )
105+ }
100106 invokeStart := time .Now ()
101107 err = server .Invoke (invokeResp , & interop.Invoke {
102108 ID : invokeR .InvokeId ,
103109 InvokedFunctionArn : invokeR .InvokedFunctionArn ,
104110 Payload : strings .NewReader (invokeR .Payload ), // r.Body,
105111 NeedDebugLogs : true ,
106112 TraceID : invokeR .TraceId ,
113+ ClientContext : string (decodedClientContext ),
107114 // TODO: set correct segment ID from request
108115 //LambdaSegmentID: "LambdaSegmentID", // r.Header.Get("X-Amzn-Segment-Id"),
109116 //CognitoIdentityID: "",
0 commit comments