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.

Juan
已提問 1 年前檢視次數 147 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南