I am trying to execute the simple example with greeter client and server. I downloaded all the affiliated files but when I am trying to run the greeter_server.js the following error throws
E1205 11:21:28.876231206 9372 server_chttp2.cc:40] {"created":"@1575537688.876213239","description":"No address added out of total 1 resolved","file":"../deps/grpc/src/core/ext/transport/chttp2/server/chttp2_server.cc","file_line":394,"referenced_errors":[{"created":"@1575537688.876211844","description":"Failed to add port to server","file":"../deps/grpc/src/core/lib/iomgr/tcp_server_custom.cc","file_line":404,"referenced_errors":[{"created":"@1575537688.876208981","description":"Failed to initialize UV tcp handle","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":72,"grpc_status":14,"os_error":"address family not supported"}]}]}
Give very precise steps you've discovered to reproduce your problem. If possible and applicable, provide us with a repository we can clone that contains a reproduction case. Also if possible and applicable, please include a Dockerfile that exhibits the problem if it's specific to a certain environment. Bug reports with no reproduction steps will be closed.
the line that throws the error in my code is this:
server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure());
I also tried 127.0.0.1:50051 but the result remains the same
I suppose it has something to do with IPv6 not being configured/supported in my machine
I think you are correct. That library automatically tries to convert to IPv6 addresses if possible and use those instead. Specifically, the issue is here: https://github.com/grpc/grpc/blob/master/src/core/lib/iomgr/tcp_server_custom.cc#L367-L376
I'm seeing a similar issue on grpc=1.24.2. Is there a way to have a nodejs gRPC server explicitly bind to ipv4 address?
Seems like binding to the pod name might solve the problem if I'm reading this line right? https://github.com/grpc/grpc/blob/master/src/core/lib/iomgr/tcp_server_custom.cc#L384
Alright, I've tried explicitly binding the pods IPv4 and I'm still getting this error. I tried a lot of things to remove the IPv6 semantic, but it seems like the underlying server still want's to bind to it.
I managed to bypass this by migrating to grpc/grpc-js instead of using the c-core version.
Any particular hurdle during the migration @mjpitz? I may try the same!
Not really. Only API change was around using 'bindAsync' instead of 'bind'
@mjpitz our migration has been more involved, but I confirm from our side as well that using grpc-js solves the issue
@fbiville ah yeah. I figured coming from the generated code side of the world would be a bit more involved. I picked up on the proto-loader early on and it's made some things easier. I also write an async/await shim that makes some of the service interfaces easier to work with.
Hello there , this is a very big issue for us as we are jailed with this particular NestJS version using this library.
Do you know if there are any workarounds to make this work in an non IPv6 environment ?
@nagaland88 I think I was able to get around this for a little bit of time by binding to the "host" ip. If you're in kubernetes, it would be the pod ip, if you're in vanilla docker, the container ip. There are some things to keep in mind when binding to the host IP instead of to the wildcard address (specifically, how things dial your service).
Most helpful comment
I'm seeing a similar issue on grpc=1.24.2. Is there a way to have a nodejs gRPC server explicitly bind to ipv4 address?