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] _a.context is not a function

See original GitHub issue
  • Package Name: @azure/storage-blob
  • Package Version: 12.4.1
  • Operating system:
  • nodejs
    • version: 14.15
  • browser
    • name/version:
  • typescript
    • version: 4.1.3
  • Is the bug related to documentation in

Describe the bug I understand this may not be related to @azure/storage-blob per se (as it look tracing related), but as the issue is triggered by a call to a code similar to the following one, I’ve figured this repo maight be a good starting point.

    const bc = new BlobClient(connectionString, containerName, blobPath, undefined);

    const downloadBlockBlobResponse = await bc.download(undefined, undefined, { conditions: { ifNoneMatch: lastKnownEtag } });

    // From https://github.com/Azure/azure-sdk-for-js/blob/af9572946ce1ba33c89118f21dd3809dbb241732/sdk/storage/storage-file-share/src/utils/utils.node.ts
    // Licence MIT (https://github.com/Azure/azure-sdk-for-js/blob/master/LICENSE)
    const buf = await streamToBuffer3(downloadBlockBlobResponse.readableStreamBody!);

After having implemented the outcome of #13481, we’re now hitting the following exception.

{
    "hasFullStack": true,
    "parsedStack": [
        {
            "sizeInBytes": 259,
            "level": 0,
            "method": "Object.getSpanContext",
            "assembly": "at Object.getSpanContext (C:\\_work\\[REDACTED]\\node_modules\\@opentelemetry\\api\\src\\context\\context.ts:77:28)",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\@opentelemetry\\api\\src\\context\\context.ts",
            "line": 77
        },
        {
            "sizeInBytes": 227,
            "level": 1,
            "method": "getParent",
            "assembly": "at getParent (C:\\_work\\[REDACTED]\\node_modules\\@opentelemetry\\tracing\\src\\Tracer.ts:147:14)",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\@opentelemetry\\tracing\\src\\Tracer.ts",
            "line": 147
        },
        {
            "sizeInBytes": 239,
            "level": 2,
            "method": "Tracer.startSpan",
            "assembly": "at Tracer.startSpan (C:\\_work\\[REDACTED]\\node_modules\\@opentelemetry\\tracing\\src\\Tracer.ts:74:27)",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\@opentelemetry\\tracing\\src\\Tracer.ts",
            "line": 74
        },
        {
            "sizeInBytes": 307,
            "level": 3,
            "method": "Tracer.tracer.startSpan",
            "assembly": "at Tracer.tracer.startSpan (C:\\_work\\[REDACTED]\\node_modules\\diagnostic-channel-publishers\\dist\\src\\azure-coretracing.pub.js:51:44)",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\diagnostic-channel-publishers\\dist\\src\\azure-coretracing.pub.js",
            "line": 51
        },
        {
            "sizeInBytes": 235,
            "level": 4,
            "method": "createSpan",
            "assembly": "at createSpan (C:\\_work\\[REDACTED]\\node_modules\\@azure\\storage-blob\\src\\utils\\tracing.ts:22:23)",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\@azure\\storage-blob\\src\\utils\\tracing.ts",
            "line": 22
        },
        {
            "sizeInBytes": 251,
            "level": 5,
            "method": "BlobClient.<anonymous>",
            "assembly": "at BlobClient.<anonymous> (C:\\_work\\[REDACTED]\\node_modules\\@azure\\storage-blob\\src\\Clients.ts:1459:35)",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\@azure\\storage-blob\\src\\Clients.ts",
            "line": 1459
        },
        {
            "sizeInBytes": 173,
            "level": 6,
            "method": "step",
            "assembly": "at step (C:\\_work\\[REDACTED]\\node_modules\\tslib\\tslib.js:143:27)",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\tslib\\tslib.js",
            "line": 143
        },
        {
            "sizeInBytes": 187,
            "level": 7,
            "method": "Object.next",
            "assembly": "at Object.next (C:\\_work\\[REDACTED]\\node_modules\\tslib\\tslib.js:124:57)",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\tslib\\tslib.js",
            "line": 124
        },
        {
            "sizeInBytes": 173,
            "level": 8,
            "method": "<no_method>",
            "assembly": "at C:\\_work\\[REDACTED]\\node_modules\\tslib\\tslib.js:117:75",
            "fileName": "C:\\_work\\[REDACTED]\\node_modules\\tslib\\tslib.js",
            "line": 117
        }
    ],
    "message": "_a.context is not a function",
    "typeName": "TypeError"
}

Relevant dependencies:

    "@azure/storage-blob": "^12.4.1",
    "@opentelemetry/api": "^0.16.0",
    "@opentelemetry/tracing": "^0.16.0",
    "applicationinsights": "^1.8.10",

To Reproduce I haven’t been able to create a standalone repro yet from scratch which would recreate the issue. And it may take me a little time before being able to make one emerge by through the removal of unnecessary production code. So I’ve figured I’d create this here in the meantime.

/cc @hectorhdzg

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
aldoreyescommented, Aug 31, 2021

We encounter this error only when the code is executed in an azure app service, and only if the application insights are turned on for that resource. We had to turn off application insights in azure to avoid this.

Our azure dependencies are:

"@azure/identity": "^1.5.1",
"@azure/keyvault-keys": "^4.3.0",
"@azure/keyvault-secrets": "^4.3.0",
"@azure/storage-blob": "^12.7.0",

The error is just not very informative, we got very lucky by trying to turn off app insights in azure and having that worked, otherwise we would still be bouncing on trying specific version of each azure package.

1reaction
spawnridercommented, Sep 8, 2021

Same issue too on Azure App Services with App Insights turned on : ** image **

Disabling App Insights seems to solve the issue. Please reopen this since it is not fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

azure storage-blob isInstrumentationSuppressed is not a ...
I am running the below code to get data from my blob storage. async function readBlob(blobName) { const blobSvc = new ContainerClient( {{ ......
Read more >
azure.storage.blob.ContainerClient class | Microsoft Learn
A client to interact with a specific container, although that container may not yet exist. For operations relating to a specific blob within...
Read more >
How to use the @azure/storage-blob.ContainerClient function ...
To help you get started, we've selected a few @azure/storage-blob.ContainerClient examples, based on popular ways it is used in public projects.
Read more >
General Guidelines: Azure Core | Azure SDKs
If you are implementing a client library in a language that already has an Azure Core library, you do not need to read...
Read more >
@azure/storage-blob - npm
Blob storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that does not adhere to a particular data ......
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