TypeError:无法读取Request._callback中未定义的属性“ statusCode”

时间:2018-10-25 06:16:06

标签: node.js http-status-code-404

我正在尝试使用用于nodejs的flowlytics模块从dialogflow检索数据,我正在尝试解决以下问题。
这是我的代码:

var Flowlytics=require('flowlytics');
//To configure the API for an authenticated  request
var tokens={
  "xsrf" : "MY_XSRF_TOKEN",
  "user_agent":"USER_AGENT",
  "cookie":"COOKIE",
  "auth":"MY_AUTHENTICATION",
};


var interval_in_days=7;
Flowlytics(tokens,interval_in_days).then(function(response){
  var msg=response.messages;
  var analytics=response.analytics;
  console.log("Success");
});

这是输出:

C:\Users\shri\Desktop\Shri\node_js\node_modules\flowlytics\index.js:26
        if(response.statusCode === 200 || response.statusCode === 201 ) {
                    ^

TypeError: Cannot read property 'statusCode' of undefined
    at Request._callback (C:\Users\shri\Desktop\Shri\node_js\node_modules\flowlytics\index.js:26:25)
at self.callback (C:\Users\shri\Desktop\Shri\node_js\node_modules\request\request.js:185:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (C:\Users\shri\Desktop\Shri\node_js\node_modules\request\request.js:881:8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)

0 个答案:

没有答案