Cannot connect gRPC Server Hosted on HuggingFace Spaces

I was trying to host a sample gRPC code in Huggingface Spaces and when i am trying to call the server via the gRPC client, i am getting the error message as Connection Refused.

This is the space - GRPC Testing - a Hugging Face Space by Bleak

Below is the detailed error message which i am getting when i am trying to connect to the Spaces via gRPC -

Traceback (most recent call last):
File “/media/kali/New Volume/MongoCommunicator/gRPC_Python/gRPC-Testing/HelloWorld/greeter_client.py”, line 38, in
run()
File “/media/kali/New Volume/MongoCommunicator/gRPC_Python/gRPC-Testing/HelloWorld/greeter_client.py”, line 32, in run
response = stub.SayHello(helloworld_pb2.HelloRequest(name=“you”))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/media/kali/New Volume/MongoCommunicator/gRPC_Python/gRPC/lib/python3.12/site-packages/grpc/_channel.py”, line 1181, in call
return _end_unary_response_blocking(state, call, False, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/media/kali/New Volume/MongoCommunicator/gRPC_Python/gRPC/lib/python3.12/site-packages/grpc/_channel.py”, line 1006, in _end_unary_response_blocking
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = “failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:50051: Failed to connect to remote host: connect: Connection refused (111)”
debug_error_string = “UNKNOWN:Error received from peer {created_time:“2024-12-21T11:00:23.394430809+05:30”, grpc_status:14, grpc_message:“failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:50051: Failed to connect to remote host: connect: Connection refused (111)”}”

In the dockerfile, i have also correctly provided the Port (7860). Can i please get some guidance about where am i going wrong ?

1 Like

Is gRPC not supported in HuggingFace Spaces ?

1 Like

The settings don’t seem to be wrong.
It may be a library that is implicitly prohibited by Spaces. There are quite a few like that…