Closed amadeogallardo closed 6 months ago
Hello @amadeogallardo , thank you for reaching out.
Migration documentation Moving from 4.0 to 4.1:
Axios is not a drop-in replacement for Popsicle. Here are a few of the API differences:
Request config: Axios uses data instead of body. Axios.get() will override the the method option. There is no transport option. Response schema: Headers are turned into an object with lower cased names. Response data is atomically parsed and can be accessed with res.data. The response can't be stringified using JSON.stringify() because of res.request.
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.
@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
Thank you @rajeshgupta723, will update to this version, review your comments above and let you know.
Has 4.1.2 been released? It doesn't show up under https://www.npmjs.com/package/intuit-oauth?activeTab=versions
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
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
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 theagent.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?