XeroAPI / xero-node

Xero Node SDK for OAuth 2.0 generated from XeroAPI/Xero-OpenAPI
http://developer.xero.com/
MIT License
197 stars 159 forks source link

Approving/rejecting leave request fails with unexpected error #646

Closed haydn closed 1 year ago

haydn commented 1 year ago

SDK:

Describe the bug

The API endpoints for approving/rejecting leave applications that were recently added the AU payroll fail. Additionally, there's no proper error returned.

To Reproduce

Steps to reproduce the behavior:

  1. Create a leave application in the "requested" state.
  2. Try to approve the leave application using xero.payrollAUApi.approveLeaveApplication(TENANT_ID, LEAVE_APPLICATION_ID)

This throws an error with this message:

Unexpected error value: { response: [Object], body: undefined }

If I enable Node's http debugging, I can see this for the response:

...
HTTP 72296: sockets api.xero.com:443::::::::::::::::::::: 1 1
HTTP 72296: outgoing message end.
HTTP 72296: AGENT incoming response!
HTTP 72296: AGENT socket.destroySoon()
HTTP 72296: CLIENT socket onClose
HTTP 72296: removeSocket api.xero.com:443::::::::::::::::::::: writable: false
HTTP 72296: HTTP socket close

So it looks like the API is failing to produce a response of any kind.

If I try to approve the leave application via the API explorer it fails without any message (so I assume the same thing is happening). I can successfully retrieve the leave application using the get leave application endpoint.

Logging into Xero and approving the leave application works fine.

Expected behavior

It should approve the leave application (or at least display an error message explaining what's wrong).

Screenshots

N/A

Additional context

N/A

github-actions[bot] commented 1 year ago

PETOSS-315

github-actions[bot] commented 1 year ago

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

rdemarco-xero commented 1 year ago

Thanks for reporting these issues @haydn ! We'll get these things fixed soon and keep you posted.

haydn commented 1 year ago

@rdemarco-xero I'm no longer seeing this issue or #645. Were some changes made to fix these? When I encountered this bug I was using a demo account — perhaps that demo account was in an invalid state? Testing with a fresh demo account now works just fine.

rdemarco-xero commented 1 year ago

Hi @haydn, this issue plus #645 were legitimate issues with our public endpoint. The team was able to release a fix last week. Glad it is working for you now. Will get a fix out to the SDK for #643 soon.

haydn commented 1 year ago

@rdemarco-xero Thanks for following this up! Very much appreciated.

Do you happen to know if creating leave applications with a "REQUESTED" status is on the cards? It's the last piece of the puzzle we need to make a seamless leave management experience.