# Cannot connect gRPC Server Hosted on HuggingFace Spaces

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-connect-grpc-server-hosted-on-huggingface-spaces%2F132511%3E%5C
**Category:** Spaces\
**Created:** [December 21, 2024, 5:34am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-connect-grpc-server-hosted-on-huggingface-spaces%2F132511 "2024-12-21T05:34:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bleak](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@Bleak](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FBleak)%5C
**Post date:** [December 21, 2024, 5:34am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-connect-grpc-server-hosted-on-huggingface-spaces%2F132511%2F1 "2024-12-21T05:34:59Z")

</div>

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](https://huggingface.co/spaces/Bleak/gRPC-Testing)

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 ?

---

<div class="post-metadata">

**Author:** ![Bleak](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@Bleak](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FBleak)%5C
**Post date:** [January 7, 2025, 4:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-connect-grpc-server-hosted-on-huggingface-spaces%2F132511%2F2 "2025-01-07T04:21:36Z")

</div>

Is gRPC not supported in HuggingFace Spaces ?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [January 7, 2025, 4:34am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-connect-grpc-server-hosted-on-huggingface-spaces%2F132511%2F3 "2025-01-07T04:34:22Z")

</div>

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…

> **[Spaces Configuration Reference](https://huggingface.co/docs/hub/spaces-config-reference)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> **[Handling Spaces Dependencies](https://huggingface.co/docs/hub/spaces-dependencies)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.
