Node library returns ECONNRESET, while curl works

Hi. I’ve a weird issue, when I use OpenAI Node library its internal fetch returns ECONNRESET, while from the very same machine if I run a curl request works correctly (returning an API error or quota exceeded).

  cause: FetchError: request to failed, reason: read ECONNRESET
      at ClientRequest.<anonymous> (/Users/maxxer/work/origlio/node_modules/node-fetch/lib/index.js:1501:11)
      at ClientRequest.emit (node:events:519:28)
      at TLSSocket.socketErrorListener (node:_http_client:495:9)
      at TLSSocket.emit (node:events:531:35)
      at emitErrorNT (node:internal/streams/destroy:169:8)
      at emitErrorCloseNT (node:internal/streams/destroy:128:3)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
    type: 'system',
    errno: 'ECONNRESET',
    code: 'ECONNRESET'

What can cause this behavior?

I dunno what causes this particular problem, but I feel like the OpenAI api libs don’t add much value.

We use axios because we found the libs to occasionally either be unreliable or behind the actual api capabilities.

1 Like

Oh sh**, I changed my Axios requests to use the lib, as it seemed simpler :rofl:

Weird the lib works fine with a third party openai-compatible provider (where indeed I do have quota available).