Open stepanh opened 3 years ago
@RettBehrens , @SerKnight - I'm now aware of one case that causes Xero API to throw the 500 Internal Server Error
- file name that contains #
. Where should that be reported?
This is still an issue in v4.11.2. I think the generator code for this is https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache . It seems to me that the parsing code body = JSON.parse(body)
was moved elsewhere, so this might be fixed in master - but not sure.
SDK you're using (please complete the following information):
Describe the bug
createBankTransactionAttachmentByFileName
hangs when it receives non-JSON response from Xero API.uncaughtException
is triggered, butPromise
never resolves or rejects.To Reproduce
createBankTransactionAttachmentByFileName
saves files by calling Xero API - i.e.https://api.xero.com/api.xro/2.0/BankTransactions/**id-redacted**/Attachments/h3h33sjg-rec.jpg
However this endpoint sometimes fails and returns this
body
. (I tried saving this same file about 10 times, in the same way, the endpoint was failing and then succeeded on the last try.)When bad body is received, it fails to parse to JSON - this line fails:
body = JSON.parse(body)
Expected behavior Well, Xero API shouldn't be failing to save files in the first place. But when it does fail, xero-node should catch JSON parse error and call
reject
.Additional context Happy to provide failing transactionIDs, etc. on request