Gradio JS Client Predict Error on Private Space

Gradio JS Client raises error when use Private Space. (Python Client works.)
connect and view_api APIs work without any issue.
When call predict API, following error happens. (If make space public, no error.)
Any help would be appreciated.

Response {
  status: 404,
  statusText: 'Not Found',
  headers: Headers {
    date: 'Tue, 29 Oct 2024 01:06:13 GMT',
    'content-type': 'text/html; charset=utf-8',
    'content-length': '3020',
    connection: 'keep-alive',
    'x-request-id': 'Sb9C2M',
    vary: 'origin, access-control-request-method, access-control-request-headers',
    'access-control-allow-credentials': 'true'
  },
  body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
  bodyUsed: false,
  ok: false,
  redirected: false,
  type: 'basic',
  url: 'https://xxxxx.hf.space/queue/data?session_hash=k03zo4aqyv'
}
Unexpected error Connection errored out.
{
  type: 'status',
  stage: 'error',
  message: 'Connection errored out. ',
  queue: true,
  endpoint: '/zzzz',
  fn_index: 1,
  time: 2024-10-29T01:06:13.435Z
}

Reproduce code

import { Client, handle_file } from "@gradio/client";

async function main() {
    const response_0 = await fetch("https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png");
    const exampleImage = await response_0.blob();

    const client = await Client.connect("User/SpaceName", {hf_token: "hf_xxxxx"});
    const result = await client.predict("/zzzzzzz", { 
        path: exampleImage, 
    });

    console.log(result);
}
main().catch(console.error)
1 Like

Another person on the HF Discord was encountering the same error, so I posted a link here on the Discord. If more than one person has the same symptom, it is most likely a bug, and the Gradio developers will be aware of it.

1 Like