1
votes

I'm working with a GRPC service hosted with HTTPS and self-signed cert. When I connect using syntax like:

const client = new productService('https://grpc-server-xxx.com:9090',
grpc.credentials.createInsecure())

I am getting the error like this

{ Error: 14 UNAVAILABLE: DNS resolution failed
at Object.exports.createStatusError (C:\grpc\node_modules\grpc\src\common.js:91:15)
at Object.onReceiveStatus (C:\grpc\node_modules\grpc\src\client_interceptors.js:1209:28)
at InterceptingListener._callNext (C:\grpc\node_modules\grpc\src\client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (C:\grpc\node_modules\grpc\src\client_interceptors.js:618:8) at callback (C:\grpc\node_modules\grpc\src\client_interceptors.js:847:24)code: 14,metadata: Metadata { _internal_repr: {}, flags: 0 },details: 'DNS resolution failed'

Anyone help me how can I resolve the issue.

Note: My OS is Windows 10, nodejs -- v10.16.0, GRPC

2

2 Answers

5
votes

The gRPC library does not recognize the https:// scheme for addresses, so that target name will cause it to try to resolve the wrong name. You should instead use grpc-server-xxx.com:9090 or dns:grpc-server-xxx.com:9090 or dns:///grpc-server-xxx.com:9090. More detailed information about how gRPC interprets channel target names can be found in this documentation page.

0
votes

Noob mistake, but I did it. Make sure your IP address is 0.0.0.0:9090 and not 0.0.0.0.9090