Grpc: error unmarshalling request: proto: wrong wireType = 2 for field StartTs


(mehrdad mohammadiyan ) #1

Hi
I create a recommendation system by golang and dgo
and i use this query for this recommend :
{


    find as var(func: allofterms(UrlName,mehrdad)) {
        sc as math(1)
        fr as friend {
            friend {
                fscore as math(sc)
            }
        }
    }
    recommendationprofile(func: uid(fscore), orderdesc: val(fscore), first: 10) @filter(not uid(find, fr)) {
        UrlName
    }
}

But when i start the project and send a UrlName with grpc show this error :

{
     "recommendedprofileid": [],
     "err": "rpc error: code = Internal desc = grpc: error unmarshalling request: proto: wrong wireType = 2 for field StartTs"
}

my function for recommend is :

func (s *recomenderStore) Recommend(ctx context.Context, profileid string) ([]string, error) {

	var resp struct {
		Find []struct {
			URLNAME []string `json:"UrlName"`
		} `json:"reecommendprofileid"`
	}

	queryvar := fmt.Sprintf(
		`{
	find as var(func: allofterms(UrlName,"%v")) {
		sc as math(1)
		fr as friend { 
			friend {
				fscore as math(sc)
			}
		}
	}
		   
		   
	recommendationprofile(func: uid(fscore), orderdesc: val(fscore), first: 10) @filter(not uid(find, fr)) {
		UrlName
	}
}`, profileid)

	fmt.Println(queryvar)
	query, err := s.client.NewTxn().Query(ctx, queryvar)

	fmt.Println(err)
	if err != nil {
		return nil, err
	}

	// parse response json recommend
	err = json.Unmarshal(query.Json, &resp)
	recommendProfileID := resp.Find[0].URLNAME

	return recommendProfileID, err
}

Can you help me ??!!


(Aman Mangal) #2

If you are using Dgraph 1.1, you should import dgo v2 github.com/dgraph-io/dgo/v2