Class constructor Pipeline cannot be invoked without 'new'

Francisco Dominguez 386 Reputation points
2021-09-23T07:38:52.63+00:00

Hi,

I'm following the documentation from @azure/storage-file-datalake, specially the List the file systems example to write an Azure Function that will take an excel file from my storage account and perform some operations with it. My code is as follows:

const Excel = require('exceljs');  
const wb = new Excel.Workbook();  

const fs = require('fs');  

const { DefaultAzureCredential } = require("@azure/identity");  
const { DataLakeServiceClient } = require("@azure/storage-file-datalake");  

module.exports = async function (context, myBlob) {  
    context.log(myBlob);  
    context.log("JavaScript blob trigger function processed blob \n Blob:", context.bindingData.blobTrigger, "\n Blob Size:", myBlob.length, "Bytes");  

    const account = "zzz";  
    const defaultAzureCredential = new DefaultAzureCredential();  

    const datalakeServiceClient = new DataLakeServiceClient(  
        `https://${account}.dfs.core.windows.net`,  
        defaultAzureCredential  
    );  

    let i = 1;  
    let iter = await datalakeServiceClient.listFileSystems();  
    for await (const fileSystem of iter) {  
        console.log(`File system ${i++}: ${fileSystem.name}`);  
    }  
};  

My package.json, looks as follows:

{  
    "dependencies": {  
        "@azure/identity": "^1.5.2",  
        "@azure/storage-file-datalake": "^12.0.0-preview.6",  
        "@azure/storage-file-share": "^12.8.0",  
        "@babel/polyfill": "^7.12.1",  
        "exceljs": "^4.3.0",  
        "read-blob": "^1.1.2"  
    }  
}  

But when trying to execute the Azure Function, I get the following error:

Executed 'Functions.ParseIQEQExcelFile' (Failed, Id=7e34fe72-8df5-4804-b445-6d5a15127869, Duration=161ms)Result: FailureException: TypeError: Class constructor Pipeline cannot be invoked without 'new'Stack: TypeError: Class constructor Pipeline cannot be invoked without 'new'at new Pipeline (C:\home\node_modules\@azure\storage-file-datalake\dist\index.js:4001:28)at newPipeline (C:\home\node_modules\@azure\storage-file-datalake\dist\index.js:4055:12)at new DataLakeServiceClient (C:\home\node_modules\@azure\storage-file-datalake\dist\index.js:6079:28)at module.exports (C:\home\site\wwwroot\ParseIQEQExcelFile\index.js:16:35)

How can I solve this problem?

Thanks!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,633 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,906 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful