question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't make grpc's client with static codegen

See original GitHub issue

Problem description

can’t make grpc client with static codegen

Environment

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:open
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
netpoeticacommented, Mar 1, 2021

I am personally seeing this as well, and I think it is because I am using credentials from grpc-js import, but using client with grpc. It is largely the result of mixing up documentation between grpc-js and grpc usage. Hope this helps someone!

0reactions
badsyntaxcommented, Apr 5, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found