intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
123 stars 159 forks source link

4.1 contains breaking changes #163

Closed amadeogallardo closed 6 months ago

amadeogallardo commented 6 months ago

Moving from 4.0 to 4.1 caused a number of issues related to the switch from Popsicle to Axios. Some of these have been fixed, but there's no documentation related to the upgrade path. For example, the getJson function is now not available, which could've been invoked by client code that used the agent.makeApiCall function.

It also seems as if thrown errors do not include an error object, which makes it really hard to troubleshoot what may have failed when performing a request. For example, trying to use the /payment endpoints is failing after the upgrade, but I can't inspect the error because apparently the parameter is now not included.

Overall, it seems as if 4.1 should've been 5.0 since it includes breaking changes that requires changes to the client codebase.

Is it possible to add some migration documentation between 4.0 and 4.1?

rajeshgupta723 commented 6 months ago

Hello @amadeogallardo , thank you for reaching out.

Migration documentation Moving from 4.0 to 4.1:

Breaking Change

Given the transport issue, this Migration does introduce a breaking change. e.g. Users that receive a PDF will have to change their code from this:

oauthClient.makeApiCall({ url: ${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59, headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'}, transport: popsicle.createTransport({type: 'buffer'}) })

To this:

oauthClient.makeApiCall({ url: ${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59, headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'}, responseType: 'arraybuffer' })

@amadeogallardo May I request you to please validate the list of breaking changes that requires changes to the client codebase?

1) getJson function is now not available, while making the makeApiCall function. 2) thrown errors do not include an error object. For example, trying to use the /payment endpoints is failing after the upgrade, but this error can't be inspected because apparently the parameter is now not included.

rajeshgupta723 commented 6 months ago

@amadeogallardo also, a new release branch has been created from the master: https://github.com/intuit/oauth-jsclient/tree/release-4.1.2

Please feel free to raise a PR over there to include the migration documentation. Thanks

amadeogallardo commented 6 months ago

Thank you @rajeshgupta723, will update to this version, review your comments above and let you know.

amadeogallardo commented 6 months ago

Has 4.1.2 been released? It doesn't show up under https://www.npmjs.com/package/intuit-oauth?activeTab=versions

amadeogallardo commented 6 months ago

Here's one of the things that I struggled with: getting the error message/code. Before, it was under this path:

authResponse.json.Fault.Error

Now it's under this path:

response.data.Fault.Error
rajeshgupta723 commented 6 months ago

Hi @amadeogallardo , Release 4.1.2 has been pushed out, please checkout at https://github.com/intuit/oauth-jsclient/releases

closing this issue. please feel free to reopen this if you still see any issues. Thanks