azure-sdk-for-js: [@azure/storage-blob] _a.context is not a function
- 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
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 15 (5 by maintainers)
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:
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.
Same issue too on Azure App Services with App Insights turned on : **
**
Disabling App Insights seems to solve the issue. Please reopen this since it is not fixed.
Sounds good. I just wanted to provide some more details to help anyone else stumbling across this until the latest packages are ready. I’m very happy to have the temporary solution via the explicit package references, but certainly the best thing is for this to be addressed across the Microsoft packages ASAP so a thousand more devs don’t have to figure it out for themselves.
@drub0y this is the related PR on ApplicationInsights SDK side, once this is merged we will publish a new version of the SDK solving this issue.