Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: Build
run: make compile-lambda-linux-all
Expand Down
21 changes: 13 additions & 8 deletions cmd/localstack/custom_interop.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -100,6 +100,9 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate rapidcore.InteropServer, lo
NeedDebugLogs: true,
InvokedFunctionArn: invokeR.InvokedFunctionArn,
})
if err != nil{
log.Fatalln(err)
}
inv := GetEnvOrDie("AWS_LAMBDA_FUNCTION_TIMEOUT")
timeoutDuration, _ := time.ParseDuration(inv + "s")
memorySize := GetEnvOrDie("AWS_LAMBDA_FUNCTION_MEMORY_SIZE")
Expand All@@ -111,21 +114,23 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate rapidcore.InteropServer, lo
// TODO: handle err
}

callErr := false
var errR ErrorResponse
err := json.Unmarshal(invokeResp.Body, &errR)
if err == nil{
callErr = true
} else{
log.Error(err)
var errR map[string]any
marshalErr := json.Unmarshal(invokeResp.Body, &errR)

if marshalErr != nil{
log.Fatalln(marshalErr)
}

if callErr{
_, isErr := errR["errorType"]

if isErr{
log.Infoln("Sending to /error")
_, err = http.Post(server.upstreamEndpoint+"/invocations/"+invokeR.InvokeId+"/error", "application/json", bytes.NewReader(invokeResp.Body))
if err != nil{
log.Error(err)
}
} else{
log.Infoln("Sending to /response")
_, err = http.Post(server.upstreamEndpoint+"/invocations/"+invokeR.InvokeId+"/response", "application/json", bytes.NewReader(invokeResp.Body))
if err != nil{
log.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/localstack/main.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,7 +69,7 @@ func main(){
go sandbox.Create()

// start runtime init
go InitHandler(sandbox, "$LATEST", 30) // TODO: replace this with a custom init
go InitHandler(sandbox, GetEnvOrDie("AWS_LAMBDA_FUNCTION_VERSION"), 30) // TODO: replace this with a custom init

// TODO: make the tracing server optional
// start blocking with the tracing server
Expand Down