Skip to content

Commit

Permalink
RSDK-9097 Accept malformed gRPC error log fields (#4480)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjirewis authored and 10zingpd committed Oct 23, 2024
1 parent d0628f4 commit aab8dc9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions logging/proto_conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ func FieldFromProto(field *structpb.Struct) (zap.Field, error) {
return zap.Field{}, err
}

// Handle poorly serialized error fields (force them into a string type with
// an empty value). Newer Golang modules should serialize correctly (turn
// errors into strings client-side) per RSDK-9097.
if zf.Type == zapcore.ErrorType {
if _, ok := zf.Interface.(error); !ok {
zf.Type = zapcore.StringType
zf.String = ""
}
}

return zf, err
}

Expand Down

0 comments on commit aab8dc9

Please sign in to comment.