Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.

Repository from Github https://github.comAzure/azure-sdk-for-jsRepository from Github https://github.comAzure/azure-sdk-for-js

Unexpected AbortError @azure/storage-file-share

andregrossinho opened this issue · comments

  • Package Name: @azure/storage-file-share
  • Package Version: 12.26.0
  • Operating system:
  • nodejs
    • version: 22
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
After upgrading Node.js from version 18 to 22, we started facing multiple errors while trying to download files from Azure Storage using this function:

async function downloadFile(directoryName, fileName) {
    try {

        directoryName = config.get("azure_storage_account.envFolder") + '/' + directoryName;
        let shareClient = serviceClient.getShareClient(shareName);
        let directoryClient = shareClient.getDirectoryClient(directoryName);
        let fileClient = directoryClient.getFileClient(fileName);
        let exists = await existsFileStorage(directoryName, fileName)
        if(!exists) {
            shareClient = serviceClient.getShareClient(shareNameHistory);
            directoryClient = shareClient.getDirectoryClient(directoryName);
            fileClient = directoryClient.getFileClient(fileName);
        }
    
        // Get file content from position 0 to the end
        // In Node.js, get downloaded data by accessing downloadFileResponse.readableStreamBody
        const result = await fileClient.download();

        return result;
        
    } catch (error) {
        throw error;
    }
}

The error that occurs is: AbortError: The operation was aborted at /usr/src/app/api/node_modules/@azure/storage-file-share/dist/index.js in RetriableReadableStream.sourceAbortedHandler at line 12647:32

This error only occurs in production, where the API is running inside a container in Azure. We are unable to reproduce it locally.
We downgraded to Node.js 18, and the errors stopped happening.

Screenshots

Image

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.