gocardless-nodejs icon indicating copy to clipboard operation
gocardless-nodejs copied to clipboard

RequestError with ERR_INVALID_ARG_TYPE

Open ghost opened this issue 4 years ago • 11 comments

Hello,

I have (in a production environment only) this kind of error that happens randomly when I try call some methods of the library (using the 1.1.2 version) like the following:

      const mandate = await client.mandates.find(mandateId);

      const { account_number_ending: bankAccountNumberEnding } = await client.customerBankAccounts.find(
        mandate.links.customer_bank_account,
      );

OR

      const { url } = await client.mandatePdfs.create(
        {
          links: {
            mandate: mandateId,
          },
        },
        '',
        {
          'Accept-Language': language || 'en',
        },
      );

The error:

"extensions": {
  "name": "RequestError",
  "code": "GOCARDLESS_ERROR",
  "exception": {
    "name": "RequestError",
    "code": "ERR_INVALID_ARG_TYPE"
  }
}

GOCARDLESS_ERROR is an internal error name, but RequestError and ERR_INVALID_ARG_TYPE are returned by GoCardless.

Do you know where this could come from? It sometimes works like a charm, but then I will have this error.

ghost avatar May 13 '20 14:05 ghost