azure-sdk-for-js icon indicating copy to clipboard operation
azure-sdk-for-js copied to clipboard

Timeout APIConnectionError during Large File Upload (200MB) - ECONNRESET

Open SuMyatHlaing30 opened this issue 5 months ago • 7 comments

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

To Reproduce

 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' } }

SuMyatHlaing30 avatar Sep 18 '24 06:09 SuMyatHlaing30