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:

  1. Use the helioslambda proxy library in version v1.34.2 or above
  2. 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 propagate
  • handleRequestLogicFunc is a method that will hold the logic of processing the message. The handleRequestLogicFunc will accept (ctx context.Context, message events.SQSMessage) and returns (any,error) .