Facing error while fetching documents from db using grpc

19 views
Skip to first unread message

KALISETTI RAMKUMAR

unread,
Aug 5, 2020, 6:53:35 AM8/5/20
to grpc.io
Hi All,

I'm using nodejs platform to build grpc application. I'm facing an error while inserting document (but successfully inserted in DB) and not able to retrieve documents from DB (using find method). As I am new to grpc not familiar on understanding the error. Please refer the attached screenshot. Any help is greatful.

Package versions:

grpc: 1.24.2
mongoose: 4.13.12 and 5.9.15 (tried both versions)
Thanks

Screenshot from 2020-08-05 16-16-24.png


Michael Lumish

unread,
Aug 5, 2020, 2:28:52 PM8/5/20
to KALISETTI RAMKUMAR, grpc.io
It's hard to be sure, but it looks like this error is coming from the server, and it looks like a message serialization error. This $__ field seems to be causing problems. I'm guessing that your gRPC server is using mongoose and then sending the resulting objects back to the client. If so, mongoose may be returning objects that are in some way incompatible with how gRPC serializes messages.

If you are currently using the grpc.load method, you may have some luck switching to the @grpc/proto-loader library, which has a newer version of the protobuf library used to serialize and deserialize messages. The README for that library includes instructions for using it with the grpc library.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b992a249-ac32-4b36-bb4d-a97cb01ed807o%40googlegroups.com.

KALISETTI RAMKUMAR

unread,
Aug 6, 2020, 7:51:52 AM8/6/20
to grpc.io
Thanks @Michael Lumish. I am  updating code based on your proposed solution. 

I want to ask one more thing, can you please brief on this proto3 field without field presence cannot be null



On Wednesday, August 5, 2020 at 11:58:52 PM UTC+5:30, Michael Lumish wrote:
It's hard to be sure, but it looks like this error is coming from the server, and it looks like a message serialization error. This $__ field seems to be causing problems. I'm guessing that your gRPC server is using mongoose and then sending the resulting objects back to the client. If so, mongoose may be returning objects that are in some way incompatible with how gRPC serializes messages.

If you are currently using the grpc.load method, you may have some luck switching to the @grpc/proto-loader library, which has a newer version of the protobuf library used to serialize and deserialize messages. The README for that library includes instructions for using it with the grpc library.

On Wed, Aug 5, 2020 at 3:53 AM KALISETTI RAMKUMAR <ramkumarka...@gmail.com> wrote:
Hi All,

I'm using nodejs platform to build grpc application. I'm facing an error while inserting document (but successfully inserted in DB) and not able to retrieve documents from DB (using find method). As I am new to grpc not familiar on understanding the error. Please refer the attached screenshot. Any help is greatful.

Package versions:

grpc: 1.24.2
mongoose: 4.13.12 and 5.9.15 (tried both versions)
Thanks

Screenshot from 2020-08-05 16-16-24.png


--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grp...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages