can't make grpc's client with static codegen
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 716
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 10
Description
### Problem 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
```typescript
// 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](https://github.com/grpc/grpc-node/blob/master/packages/grpc-js/src/channel.ts#L173-L177)
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. 😢
Contributor guide
Assessment
This issue has not been assessed yet.