使用node.js,Azure Service Bus和Apps Insight的Azure功能 - 在设置AppsInsights

时间:2017-09-11 10:02:43

标签: node.js azure azure-functions

当我使用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模块之间依赖关系的结果。

如何克服这一点的任何建议表示赞赏!

1 个答案:

答案 0 :(得分:1)

根据您的描述,我创建了我的JavaScript HttpTrigger函数来检查此问题。我使用 applicationinsights(版本0.22.0),我可以按如下方式重现此问题:

enter image description here

<强>的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),然后按预期方式工作如下:

enter image description here