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 Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions