diff --git a/lib/client/client.go b/lib/client/client.go index 430501cb46713..441ad92826c10 100644 --- a/lib/client/client.go +++ b/lib/client/client.go @@ -32,6 +32,7 @@ import ( "time" "github.com/gravitational/trace" + "github.com/gravitational/trace/trail" "github.com/moby/term" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" @@ -514,11 +515,12 @@ func (proxy *ProxyClient) IssueUserCertsWithMFA(ctx context.Context, params Reis Init: initReq, }}) if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } resp, err := stream.Recv() if err != nil { + err = trail.FromGRPC(err) // Older versions will NOT reply with a MFARequired response in the // challenge and will terminate the stream with an auth.ErrNoMFADevices error. // In this case for all protocols other than SSH fall back to reissuing @@ -567,16 +569,16 @@ func (proxy *ProxyClient) IssueUserCertsWithMFA(ctx context.Context, params Reis mfaResp, err := promptMFAChallenge(ctx, proxy.teleportClient.WebProxyAddr, mfaChal) if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } err = stream.Send(&proto.UserSingleUseCertsRequest{Request: &proto.UserSingleUseCertsRequest_MFAResponse{MFAResponse: mfaResp}}) if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } resp, err = stream.Recv() if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } certResp := resp.GetCert() if certResp == nil {