can't make grpc's client with static codegen
See original GitHub issueProblem description
can’t make grpc client with static codegen
Environment
- Node version is v14.15.4
- NVM version is 0.35.1
- “@grpc/grpc-js”: “^1.2.8”,
- “@grpc/proto-loader”: “^0.5.6”
Additional context
// Making Client Code
_initializeStaticClient(options: GrpcServiceOptions) {
options.protos.forEach(p => {
const path = `${PREFIX_PATH}/${options.serviceName}/model/${p.proto}`;
const service = require(path + `_grpc_pb`);
const Client = service[p.proto + `Client`]; // Client objects exist.
// But, here is error throw
// message is `Channel credentials must be a ChannelCredentials object`
const c = new Client(p.url, grpc.credentials.createInsecure());
});
}
@grpc/grpc-js is throw error here
When created through grpc.credentials.createInsecure()
, please check the reason for the failure under the condition.
I don’t understand why this phenomenon is happening, so I ask for your help. 😢
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
gRPC Server and Client examples with Typescript (static ...
In this example Greeter . This is the only code needed to create a server and a client along with two dependencies: @grpc/grpc-js...
Read more >Basics tutorial | Node - gRPC
This tutorial provides a basic Node.js programmer's introduction to working with gRPC. By walking through this example you'll learn how to:.
Read more >Nodejs, Include Static Codegen Protobuf/gRPC files from ...
Good day,. I am using protoc to generate pb files for nodejs. This step works fine. The proto files, and the code generated...
Read more >Protocol Buffers/gRPC Codegen Integration Into .NET Build
You must add a reference to the NuGet packages Grpc.Tools and Grpc (the latter is a meta-package, in turn referencing Grpc.Core and Google.Protobuf...
Read more >The Weird World of gRPC Tooling for Node.js, Part 1 - Medium
Just as with protobuf, there are solutions for implementing clients using static or dynamic code generation. The confusing part is that gRPC ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am personally seeing this as well, and I think it is because I am using credentials from
grpc-js
import, but using client withgrpc
. It is largely the result of mixing up documentation between grpc-js and grpc usage. Hope this helps someone!@murgatroid99 what do you think about adding a link to https://github.com/badsyntax/grpc-js-typescript in the docs somewhere as a reference for generating typescript types? I feel it would be useful for folk.