GRPC Error: Parameter to MergeFrom() must be instance of same class

3k Views Asked by At

I have seen all previous questions about this, but nothing seems to be working on my end. I am trying to run a test that uses a protobuf generated file, called 'resource_pb2'. I am using Python 3.8 with grpc 1.33.2 and protobuf version 3.14.

When using a class from this protobuf generated file, my test fails with the following error:

Parameter to MergeFrom() must be instance of same class: expected RecognitionResource got RecognitionResource

I've checked the type and id's of all the "recognition resource" classes being called in that particular test, and I get the following:

<class 'resource_pb2.RecognitionResource'> 2069160783760
<class 'resource_pb2.RecognitionResource'> 2069160783760
<class 'resource_pb2.RecognitionResource'> 2069160783760

They are clearly all being called from the same source, so why is this issue occuring?

2

There are 2 best solutions below

0
On

I had a similar issue and the reason was that I had made a mistake when passing parameters to the function. The problem was solved when I realized about my bug and I invoked the function in the right way, with all required parameters properly set. Hope it helps.

1
On

Concat of serialize.message of two different table can be done or not please can you guilde in grpc while making the api

Ex : one serialize data from user table second from the serilize data from hobbies and there is no foreign key between the two table then we gonna concat the two serialize data from the different table