Lambda in Go
Use the installation instructions below to ensure context propagation when installing Helios using Lambda in Go.
In order to allow context propagation between Lambda, SQS and EventBridge in Go, a helper method is needed to extract the context before processing the message.
In order to apply it you'll need to:
- Use the
helioslambda
proxy library in version v1.34.2 or above - Modify your method that handles the lambda request to call the
helioslambda.HandleRequest
method in the following way:
func () handleRequest(event SQSEvent) () {
for _, message := range event.Records {
_, err = helioslambda.HandleRequest(ctx, message, handleRequsestLogicFunc)
if err != nil {
return err
}
}
}
Where:
ctx
is the current context you want to propagatehandleRequestLogicFunc
is a method that will hold the logic of processing the message. ThehandleRequestLogicFunc
will accept (ctx context.Context
,message events.SQSMessage
) and returns (any,error
) .
Updated about 1 month ago