question

FranciscoDominguez-7929 avatar image
0 Votes"
FranciscoDominguez-7929 asked FranciscoDominguez-7929 answered

Class constructor Pipeline cannot be invoked without 'new'

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-functionsazure-storage-accounts
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

FranciscoDominguez-7929 avatar image
0 Votes"
FranciscoDominguez-7929 answered

Solve using the latest version, 12.7.0.

Perhaps you should update the npm site?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.