无法读取未定义的属性“结果”

时间:2016-05-12 09:45:39

标签: javascript node.js bugzilla nodeapi

我正在尝试使用bz节点模块连接到我的bugzilla服务器。

使用以下代码

var bz = require("bz");

var bugzilla = bz.createClient({
  url: "https://bugzillaserver/bugzilla/",
  username: 'username',
  password: 'password',
  timeout: 30000
});

bugzilla.getBug(1005, function(error,bug){
    if (!error) {
    alert(bug.summary);
  }
});

当我尝试运行此代码时,我收到以下错误

D:\testProject\node_modules\bz\build\node\index.js:365
  if (typeof parsedBody.result !== 'undefined') {
                       ^
TypeError: Cannot read property 'result' of undefined
at BugzillaClient.handleResponse (D:\testProject\node_modules\bz\build\node\index.js:365:28)
at _APIRequest.req.onerror (D:\testProject\node_modules\bz\build\node\index.js:334:14)
at dispatchEvent (D:\testProject\node_modules\bz\node_modules\xmlhttprequest\lib\XMLHttpRequest.s:591:25)
at handleError (D:\testProject\node_modules\bz\node_modules\xmlhttprequest\lib\XMLHttpRequest.s:533:10)
at ClientRequest.errorHandler (D:\testProject\node_modules\bz\node_modules\xmlhttprequest\lib\XMLHttpRequest.s:459:14)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1528:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at Socket.onerror (tls.js:1425:17)
at Socket.EventEmitter.emit (events.js:117:20)

请帮我解决这个问题。提前谢谢。

0 个答案:

没有答案