AzureOpenAI FileUpload - Timeout APIConnectionError during Large File Upload (>200MB)

Su Myat Hlaing 245 Reputation points
2024-11-21T02:53:29.2833333+00:00

About this case, I posted in azure github, but do not get answer yet.
https://github.com/Azure/azure-sdk-for-js/issues/31148#issuecomment-2389261458

Describe the bug When attempting to upload a large file (>200MB) to the Azure OpenAI API using the OpenAI Node.js SDK, the request fails with an ECONNRESET error. The error seems to occur when the upload exceeds a certain size, as smaller files upload without issue. https://platform.openai.com/docs/api-reference/files/create

 const file = await openai_client.files.create({
      file: fs.createReadStream(path.join(__dirname, './uploads/testfile.pdf')),
      purpose: 'assistants',
    });

Expected behavior The file should upload successfully without a connection reset error because there is a description in api documentation like - Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.

Additional context Additional Info:

The issue only occurs with larger files (200MB+). Smaller files upload successfully. Node.js version: 20 OpenAI SDK version: V2

APIConnectionError: Connection error.
at AzureOpenAI.makeRequest (...\node_modules\openai\core.js:304:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runThread (...\fileTestOpenai.js:23:16)
at async main (...\fileTestOpenai.js:19:5) {
status: undefined,
headers: undefined,
request_id: undefined,
error: undefined,
code: undefined,
param: undefined,
type: undefined,
cause: FetchError: request to https://...openai.azure.com//openai/files?api-version=2024-07-01-preview failed, reason: read ECONNRESET
at ClientRequest. (...\node_modules\node-fetch\lib\index.js:1501:11)
at ClientRequest.emit (node:events:517:28)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:529:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'ECONNRESET',
code: 'ECONNRESET'
}
}

  • Resource - East US region.
  • deployment = "gpt-4o"
  • API Version = "2024-07-01-preview"

image

Azure OpenAI in Foundry Models

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.