Some times getting data..sometimes TypeError: Cannot read properties of null (reading 'url') (In stripe getting balance summary report)

问题描述 投票:0回答:0

有时获取数据..有时 TypeError: Cannot read properties of null (reading 'url')

我的代码

  let data = req.query;
  console.log(data);
  // const reportType = await stripe.reporting.reportTypes.retrieve('balance.summary.1');
  const reportRun = await stripe.reporting.reportRuns.create({
    report_type: "balance.summary.1",
    parameters: {
      interval_start: data.startDate,
      interval_end: data.endDate,
      timezone: "America/Los_Angeles",
      columns: ["category", "description", "net_amount", "currency"],
    },
  });
  const url = reportRun.result.url;
//rest of the code is getting file data & convert file ton JSON

响应(有时可以...有时会超出指定的错误)

[
    {
        "category": "starting_balance",
        "description": "Starting balance (2023-02-28)",
        "net_amount": 33871.49,
        "currency": "usd"
    },
    {
        "category": "activity_gross",
        "description": "Account activity before fees",
        "net_amount": 2875.43,
        "currency": "usd"
    }
]

similar questions are for db related queries..but here Stripe related..

node.js stripes
© www.soinside.com 2019 - 2024. All rights reserved.