ReferenceError: EventSource is not defined
when API request in Node.js #6352
Closed
Description
Describe the bug
I am testing API request in Node.js with @gradio/client.
But, ReferenceError: EventSource is not defined
is occured when I execute the code by the command.
Have you searched existing issues? 🔎
- I have searched and found no existing issues
Reproduction
"type": "module"
must be set in package.json
test.js
import { client } from "@gradio/client";
const app = await client("gradio/hello_world");
const result = await app.predict("/predict", [
"John",
]);
console.log(result.data);
Then, execute node test.js
in the command
Screenshot
No response
Logs
file:///C:/source/gradio_test/nodejs_client0.7.2/node_modules/@gradio/client/dist/index.js:733
eventSource = new EventSource(url);
^
ReferenceError: EventSource is not defined
at file:///C:/source/gradio_test/nodejs_client0.7.2/node_modules/@gradio/client/dist/index.js:733:13
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v20.9.0
System Info
Node.js v20.9.0
@gradio/client 0.7.2
Severity
I can work around it