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.
5,909 questions
Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,529 questions
0 comments No comments
{count} votes

Accepted answer
  1. Francisco Dominguez 386 Reputation points
    2021-09-23T09:36:48.783+00:00

    Solve using the latest version, 12.7.0.

    Perhaps you should update the npm site?

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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