Bro Bant
unread,Nov 3, 2022, 5:10:17 AM11/3/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to grpc.io
I have attempted all I can to send and receive arbitrary data using `google.protobuf.Struct` from NodeJS all to no success.
I am using the official `@grpc/grpc-js` npm package for all my needs.
Below is my proto file:
message WorkSpaceRequest{
google.protobuf.Struct body=1;
}
message WorkSpaceResponse{
google.protobuf.Struct workspace=1;
}
Here is how I sent out the request from a NodeJS Client
function findById(id) {
client?.findById({ body: {id:xxxxxx} }, (err, response) => {
if (err) {
console.log(err);
return;
}
let workspace=response.workspace;
//Below is the response that keeps coming back
{
"fields": {}
}
});
}
Here is my rpc implementation function:
function findById(call, callback) {
let {id} = call.request.body; //Id always comes in as undefined even though it has a value to it.
let sampleWorkspaceSpace = {
"name": "Sample Workspace Name",
"id": "Sample Workspace Id"
}
callback(null, { workspace: sampleWorkspaceSpace });
}
What could I be doing wrong?