自动分页功能无法处理条带节点超时错误?

时间:2019-05-31 13:22:52

标签: node.js express stripe-payments

Stripe流行的条带节点库在运行自动分页功能时经常超时。

stripe.charges.list().autoPagingEach(async charge => {
        await collectCharges(charge);
        if (charge === '') {
            return false;
        }
    }).then(() => {
        console.log('-Done retrieving charges-');
    });

尽管Stripe推荐,尝试使用我们自己的代码或提供的节点包中的catch块也无济于事。

在提供的程序包中条带化代码,该程序包的堆栈跟踪点指向:

req.on('error', function(error) {
        if (self._shouldRetry(null, requestRetries)) {
          return retryRequest(makeRequest, apiVersion, headers, 
requestRetries);
        } else {
          return self._errorHandler(req, requestRetries, callback)(error);
        }
      }
      });

这将引发错误:

(node:415) UnhandledPromiseRejectionWarning: Error: An error occurred with 
our connection to Stripe.
    at Constructor._Error (/mnt/c/projects/accounts- 
page/node_modules/stripe/lib/Error.js:12:17)
     at Constructor (/mnt/c/projects/accounts- 
page/node_modules/stripe/lib/utils.js:139:13)
     at new Constructor (/mnt/c/projects/accounts- 
page/node_modules/stripe/lib/utils.js:139:13)
     at /mnt/c/projects/accounts- 
page/node_modules/stripe/lib/StripeResource.js:218:9
     at ClientRequest.<anonymous> (/mnt/c/projects/accounts- 
page/node_modules/stripe/lib/StripeResource.js:427:67)
    at ClientRequest.emit (events.js:189:13)
    at TLSSocket.socketOnEnd (_http_client.js:426:9)
    at TLSSocket.emit (events.js:194:15)
    at endReadableNT (_stream_readable.js:1103:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

条带无法解释“我们的”指的是谁:“发生错误     我们与Stripe的联系。'

是“我们的”条纹还是其他人?

为什么超时会导致严重故障,并且如果Stripe无法响应,我们如何继续尝试?

0 个答案:

没有答案