带有node.js,Azure服务总线和Apps Insight的Azure功能-AppsInsights设置错误 [英] Azure Functions with node.js, Azure Service Bus and Apps Insight - Error on setup of AppsInsights
问题描述
当我使用azure模块(用于查询Service Bus)和Application Insights模块时,在初始化AppsInsight时出现以下错误:
When I use azure module (to query Service Bus) and Application Insights module, I get the following error upon initialization of AppsInsight:
System.Exception : Error: Zone already loaded. at new Error (native) at Error.AppInsightsAsyncCorrelatedErrorWrapper
要复制的代码非常简单:
The code to replicate it is very simple:
var azure = require('azure');
var serviceBusService = azure.createServiceBusService(<Service Bus Endpoint>);
const appInsights = require("applicationinsights");
appInsights.setup(<Apps Insight key>).start();
该错误抛出在最后一行,我认为是azure和applicationinsights模块之间的依赖项重叠的结果.
The error is thrown on the last line and I assume is a result of dependencies overlapping between azure and applicationinsights module.
任何建议如何克服这一点,不胜感激!
Any suggestions how to overcome this are appreciated!
推荐答案
根据您的描述,我创建了JavaScript HttpTrigger函数来检查此问题.我使用了 applicationinsights(0.22.0版),并且可以按以下方式重现此问题:
According to your description, I created my JavaScript HttpTrigger function to check this issue. I used applicationinsights (version 0.22.0) and I could reproduce this issue as follows:
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)
,那么它可以像预期如下:
Then I checked the applicationinsights package and call appInsights.setAutoDependencyCorrelation(false)
, then it could work as expected as follows:
这篇关于带有node.js,Azure服务总线和Apps Insight的Azure功能-AppsInsights设置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!