简体   繁体   English

类型错误:chargebee.subscription.list 不是 function

[英]TypeError: chargebee.subscription.list is not a function

When I'm trying to make request with Chargebee I'm getting an error当我尝试使用 Chargebee 发出请求时出现错误

TypeError: this.chargebee.subscription.list is not a function类型错误:this.chargebee.subscription.list 不是 function

But it's defined when I'm trying to debug it:但它是在我尝试调试它时定义的: 在此处输入图像描述

This is function where I'm making the request:这是我提出请求的 function:

 async test(){
    return new Promise((resolve, reject) => {
      this.chargebee.subscription.list({
        limit: 2,
        "plan_id[in]": ["basic", "no_trial"]
      }).request(function (error, result) {
        if (error) {
          //handle error
          console.log(error);
        } else {
          resolve(result)
          for (var i = 0; i < result.list.length; i++) {
            var entry = result.list[i]
            console.log(entry);
            var subscription = entry.subscription;
            var customer = entry.customer;
            var card = entry.card;
          }
        }
      });
    })
  }

Why we have error that function is undefined, when it is defined?为什么在定义 function 时出现未定义的错误? Appreciate any help, Thanks!感谢任何帮助,谢谢!

Why we have error that function is undefined, when it is defined?为什么在定义 function 时出现未定义的错误?

Your error isn't that the function is undefined, it's that this.chargebee.subscription.list is not a function. Indeed, take a look at your debugging output: list = Object {request: } - it's an object, not a function, yet you're trying to call it as a function: this.chargebee.subscription.list(...).request(...)您的错误不是 function 未定义,而是this.chargebee.subscription.list不是 function。确实,看看您的调试 output: list = Object {request: } - 它是 88282995409a848865,not 88863 ,但您试图将其称为 function: this.chargebee.subscription.list(...).request(...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM