question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[@azure/storage-blob] Top level error fields missing data

See original GitHub issue
  • Package Name: @azure/storage-blob
  • Package Version: 12.3.0
  • Operating system:
  • nodejs
    • version: 14.15.1
  • typescript
    • version: 4.1.3

Describe the bug

When encountering a rest error, specifically in my case an error downloading a non-existing blob, I noticed the following top-level fields missing:

  • code (undefined)
  • message (empty string)

error.details?.errorCode contains the ContainerNotFound or BlobNotFound message but I was wondering if having the top-level error fields missing might lead to confusion

To Reproduce Steps to reproduce the behavior:

The following code snippet should do it:

export async function test() {
  const STORAGE_CONNECTION_STRING = "REPLACE WITH CONNECTION STRING"
  const service = BlobServiceClient.fromConnectionString(
    STORAGE_CONNECTION_STRING
  );

  try {
    let container = service.getContainerClient("blobs");
    let client = container.getBlobClient("does-not-exist.txt");
    let buffer = await client.downloadToBuffer();
  } catch (error) {
    console.log(error.details?.errorCode); // ContainerNotFound or BlobNotFound
    if (error instanceof RestError) {
      console.log(error.code, error.statusCode, error.message); // undefined, 404, ""
    }
  }
}

Expected behavior

My first thought is that error.message should show the same message that I see when I let the exception propagate, and that error.code should have some meaningful value. I don’t know if it should be BlobNotFound like in error.details?.errorCode or mirror error.statusCode but I can definitely see someone falling into this pit by using IntelliSense.

Additional context

The example is helpful here, but you have to know to look for it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ramya-rao-acommented, Apr 9, 2021

This is great to hear!

@jeremymeng Can we add a similar comment in #5796 just in case anyone lands there?

1reaction
jeremymengcommented, Apr 8, 2021

This has been fixed. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure-storage-blob failing to create container when used with ...
Describe the bug. When attempting to create a container in the Azurite emulator, the operation fails with the following error: ; To Reproduce...
Read more >
azure.storage.blob package - Microsoft Learn
If any required fields are missing, the request will fail. ... All data in Azure Storage is encrypted at-rest using an account-level encryption...
Read more >
azblob - Go Packages
Package azblob allows you to manipulate Azure Storage containers and blobs objects.
Read more >
Missing Data and Systematic Bias - PMC - NCBI - NIH
Systematic bias occurs when there is a methodological deviation from the true values.2 Systematic error is introduced when a researcher inappropriately ...
Read more >
Guidance for using Azure Storage Explorer with Azure AD ...
Background — Azure Blob Storage (including Azure Data Lake Gen2) ... assigned lower than the Container level, container is the top level folder...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found