GRPC - nodejs DNS resolution failed

ぐ巨炮叔叔 提交于 2021-02-08 06:57:21

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/62108070/grpc-nodejs-dns-resolution-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!