Xero-NetStandard icon indicating copy to clipboard operation
Xero-NetStandard copied to clipboard

Null Responses Returned From AccountingApi Client

Open phil000 opened this issue 1 year ago • 5 comments

SDK you're using (please complete the following information): Xero.NetStandard.OAuth2 4.0.1 Xero.NetStandard.OAuth2Client 1.6.0

Describe the bug We have been using the Xero.NetStandard.OAuth2 packages for several years to integrate with Xero with no real issue. In the last 2 months or so various API's have been returning a null 'response'. We would not expect that. If the API call is successful we'd expect the response object back, otherwise if it is not successful we'd expect an exception telling us the issue. This issue does not happen all the time, but happens occasionally, like twice a week.

Additionally, we have several customers that we integrate with Xero for using a Custom Connection, and the issue occurs across these different customers\connections.

e.g. This call can occasionally return a null 'response'

XeroModel.Attachments response = await _accountingApi.CreateInvoiceAttachmentByFileNameAsync(AccessToken, TenantId, guid, filename, fileData, includeOnline: true);

e.g. This call can occasionally return a null 'response'

XeroModel.Invoices response = await _accountingApi.CreateInvoicesAsync(AccessToken, TenantId, invoices);
  1. Does a null response indicate success or failure?
  2. How do we tell what the actual issue is if the response is null?
  3. Is there any log where we can review historical incidents to see the cause?

phil000 avatar Mar 13 '24 22:03 phil000

PETOSS-404

github-actions[bot] avatar Mar 13 '24 22:03 github-actions[bot]

Thanks for raising an issue, a ticket has been created to track your request

github-actions[bot] avatar Mar 13 '24 22:03 github-actions[bot]

Here is when it has occurred, in the last 30 days:

2/20/2024, 10:12:07.3756086 AM (Local time) 2/28/2024, 7:26:24.4069928 AM (Local time) 2/28/2024, 7:27:14.9976902 AM (Local time) 2/29/2024, 6:00:58.8381496 PM (Local time) 3/5/2024, 7:43:04.2017037 AM (Local time) 3/14/2024, 10:32:45.7978562 AM (Local time) 3/14/2024, 10:38:54.6725353 AM (Local time)

phil000 avatar Mar 14 '24 23:03 phil000

Possibly the issue here? In DefaultExceptionFactory if the status code is 0 you get null returned.

I've see this happen (0 status code) when the issue is in the .Xero.NetStandard.OAuth2.Client.ApiClient itself.

image

phil000 avatar Mar 27 '24 00:03 phil000

So we've started using the client methods ending in "WithHttpInfo" to gather a bit more information from the returned ApiResponse.

What we see when null is returned is that the ApiResponse StatusCode is 0, and the ErrorText is "The operation was canceled".

Response StatusCode: 0 Response ErrorText: The operation was canceled. Response Body:

Looks like a client side timeout is causing the DefaultExceptionFactory to return null.

phil000 avatar Apr 03 '24 23:04 phil000