transitive-bullshit / agentic

AI agent stdlib that works with any LLM and TypeScript AI SDK.
https://agentic.so
MIT License
16.27k stars 2.13k forks source link

TypeError: fetch failed | or fails silently #482

Closed Elitezen closed 1 year ago

Elitezen commented 1 year ago

Verify latest release

Verify webapp is working

Environment details

Describe the Bug

This library was working fine a day earlier. However, I now get following error:

node:internal/deps/undici/undici:5536
          p.reject(Object.assign(new TypeError("fetch failed"), { cause: response.error }));
                                 ^

TypeError: fetch failed
    at Object.processResponse (node:internal/deps/undici/undici:5536:34)
    at node:internal/deps/undici/undici:5858:42
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:202:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: ConnectTimeoutError: Connect Timeout Error
      at onConnectTimeout (C:\Users\aleja\Documents\workspace\npm_modules\discordjs-chatgpt\node_modules\undici\lib\core\connect.js:182:24)
      at C:\Users\aleja\Documents\workspace\npm_modules\discordjs-chatgpt\node_modules\undici\lib\core\connect.js:129:46
      at Immediate._onImmediate (C:\Users\aleja\Documents\workspace\npm_modules\discordjs-chatgpt\node_modules\undici\lib\core\connect.js:168:33)
      at process.processImmediate (node:internal/timers:471:21) {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}

This will occur rarely. Currently, the vast majority of my attempts fail silently and I do not get any sort of response even when using streaming with onProgress()

const api = new ChatGPTAPI({
  apiKey: '...'
})

const res = await api.sendMessage('Hello World!', {
  onProgress: (partialResponse) => console.log(partialResponse.text)
})

console.log(res.text)

Chat-GPT responds fine on OpenAI

transitive-bullshit commented 1 year ago

OpenAI's API has been having some downtime today Check their status page for details.

transitive-bullshit commented 1 year ago

https://status.openai.com/

cyrusssschen commented 1 year ago

getting the same error today.

transitive-bullshit commented 1 year ago

I see this occasionally from OpenAI's API. Unfortunately, I don't think there's much we can do about it.

If anyone finds more information and is able to create a reproducible test case for this, I'd be interested in a follow-up.

Closing for now as unfortunately not actionable on our end.