Using xray on a Golang lambda function for Cognito

0

Hi there, I was reading the official documentation on https://github.com/aws/aws-xray-sdk-go but not quite sure how can I add the Cognito client that is created on my lambda function to the service map and x-ray traces.

import (
    "context"
    cognito "github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider"
   "github.com/aws/aws-xray-sdk-go/xray"
)

func GetClient() {
...
cfg, errCfg := config.LoadDefaultConfig(context.TODO())
client := cognito.NewFromConfig(cfg)

// the next line is not valid, because the function receives a *client.Client as a parameter
// and my current client si of type *cognito.Client
// the error is: cannot use client (variable of type *cognitoidentityprovider.Client) as *"github.com/aws/aws-sdk-go/aws/client".Client value in argument to xray.AWS
xray.AWS(client)
...
}

I appreciate your advice.

No hay respuestas

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas