Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: "axios" and "@availity/api-axios" Incompatibility #587

Closed
JackieShrader opened this issue May 1, 2023 · 0 comments
Closed

Update: "axios" and "@availity/api-axios" Incompatibility #587

JackieShrader opened this issue May 1, 2023 · 0 comments
Assignees

Comments

@JackieShrader
Copy link

Current versions in Claim Status UI:
"@availity/api-axios": "^6.0.7",

"axios": "^0.21.4"

Desired versions:

"@availity/api-axios": "^7.3.1",
"axios": "^1.3.3"

Problem:
This is the package.json for "@availity/api-axios" at version 7.3.1:
https://github.com/Availity/sdk-js/blob/master/packages/api-axios/package.json

Note the peer dependencies section at line 45:
https://github.com/Availity/sdk-js/blob/master/packages/api-axios/package.json#L45
"peerDependencies" : { axios": "^0.21.4" }

In Claim Status UI, updating just "@availity/api-axios" to version 7.3.1 is fine. No issues there.

The problem is updating axios to version 1 ("axios": "^1.3.3").
This version is incompatible with "@availity/api-axios": "^7.3.1".

Specifically, axios@^1.3.3 breaks the .query method found in "@availity/api-axios": "^7.3.1".

Where and (possibly) why the query function fails: "@availity/api-axios": "^7.3.1"
https://github.com/Availity/sdk-js/blob/master/packages/api-axios/src/resources/userPermissions.js

class AvUserPermissionsApi extends AvApi, so let's look at AvApi:
https://github.com/Availity/sdk-js/blob/master/packages/api-axios/src/api.js

Here, the query method invokes the request method:

Screen Shot 2023-02-20 at 2 14 39 PM

In the request method, this is the line that fails and causes an error to be thrown:

Screen Shot 2023-02-20 at 2 11 21 PM

My theory:
It does not like this block of code:
https://github.com/Availity/sdk-js/blob/master/packages/api-axios/src/api.js#L16

const

{ http, ...options }
= config; // http is undefined in this scenario
this.http = http || axios ; // so axios gets assigned to the http variable.

https://github.com/Availity/sdk-js/blob/master/packages/api-axios/src/api.js#L144

Screen Shot 2023-02-20 at 2 11 21 PM (1)

Note that line 144 works for get requests such as getting the user and getting regional information:

But line 144 breaks if the request method is invoked from the AvApi query method.

Summary:
In the claim status UI, any API services that invoke the .query method will most likely break. We cannot update axios to version 1
unless this is resolved in @availity/api-axios.

Further details can be found here: https://jira.availity.com/browse/CMT-1137

@bjnewman bjnewman self-assigned this May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants