Huggingface Space Not Resolving Domain Name

Hi everyone,

I’m encountering an issue with my Hugging Face Space where the domain name for an external API is not resolving, even though the domain is available. Below is the error traceback I’m getting:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1935, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1520, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 962, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 826, in wrapper
    response = f(*args, **kwargs)
  File "/home/user/app/app.py", line 111, in process_inputs
    output = classify_prompt(category,conv_prefix, response)
  File "/home/user/app/app.py", line 57, in classify_prompt
    response = requests.request("POST", url, json=payload, headers=headers)
  File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 700, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.collinear.ai', port=443): Max retries exceeded with url: /api/v1/judge/safety (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fcb7483a320>: Failed to resolve 'api.collinear.ai' ([Errno -2] Name or service not known)"))
1 Like

If you don’t add api., you can access it properly…
Whether this is a mistake or not, I think it’s some kind of restriction.

@meganariley What on earth is this?

For it to work. I need the endpoint with api. And it seems to be a weird restriction can someone from HF Team solve this

1 Like

It’s probably a genuine HF regulation or a mistake regulation. If it’s a mistake regulation, it should be possible to fix it by just modifying the settings a little…

So I tried running a curl request where

curl https://api.openai.com
{
    "message": "Welcome to the OpenAI API! Documentation is available at https://platform.openai.com/docs/api-reference"
}

works whereas

curl api.collinear.ai
curl: (6) Could not resolve host: api.collinear.ai

Does not work. Seems to be an issue with the DNS

1 Like