当我使用azure模块(查询Service Bus)和Application Insights模块时,我在AppsInsight初始化时收到以下错误:
System.Exception : Error: Zone already loaded. at new Error (native) at Error.AppInsightsAsyncCorrelatedErrorWrapper
复制它的代码非常简单:
var azure = require('azure');
var serviceBusService = azure.createServiceBusService(<Service Bus Endpoint>);
const appInsights = require("applicationinsights");
appInsights.setup(<Apps Insight key>).start();
在最后一行抛出错误,我假设是azure和applicationinsights模块之间依赖关系的结果。
如何克服这一点的任何建议表示赞赏!
答案 0 :(得分:1)
根据您的描述,我创建了我的JavaScript HttpTrigger函数来检查此问题。我使用 applicationinsights(版本0.22.0),我可以按如下方式重现此问题:
<强>的package.json:强>
{
"name": "functions-app-insights",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"applicationinsights": "^0.22.0",
"node-uuid": "^1.4.8"
}
}
然后我检查了applicationinsights包并致电appInsights.setAutoDependencyCorrelation(false)
,然后按预期方式工作如下: