0
votes

I am using the @azure/storage-blob version 12 SDK in my Javascript project and using the following syntax to get a list of blobs from a container. The following code results in the error Cannot read property 'blobItems' of undefined:

var i = 1;
  for await (const blob of containerClient.listBlobsFlat()) {
    console.log(`Blob ${i++}: ${blob.name}`);
  }

containerClient is defined and is being used successfully with other operations like uploading blobs etc. Incidentally, I have successfully listed my blobs from the same container and using the same SAS token in a node.JS project using the same @azure/storage-blob package.

1
What you do mean Javascript project? Is that you run the script in the browser with html file? - Jim Xu

1 Answers

0
votes

I ended up using Azure rest api rather than the @azure/storage-blob library to obtain the list of blobs.

https://myaccount.blob.core.windows.net/mycontainer?restype=container&comp=list