rsm-hcd / AndcultureCode.JavaScript.React

Common patterns, functions, etc... used when building react applications
6 stars 8 forks source link

Investigate upgrading to axios 0.21.1 #60

Open brandongregoryscott opened 3 years ago

brandongregoryscott commented 3 years ago

Updating this story as we have since downgraded back to the original version of axios (0.19.2). Troubleshoot the axios 0.21.1 upgrade and make necessary code updates (or suggest necessary code updates). Expand the original description below and see comments for additional information that may aid the investigation.

Original issue description Recently tried to upgrade a client project to `0.4.2` which includes the new version of axios (`0.21.1`) and it will not startup anymore - all of the API calls are redirect looping. The client project also required `axios` as its own dependency, which was upgraded at the same time to the newer version. This may be easier to test in a smaller project, possibly the dotnet/react boilerplate we have. ![image](https://user-images.githubusercontent.com/11774799/104620216-bf378980-565c-11eb-81a5-eb5a2553a474.png)
brandongregoryscott commented 3 years ago

Additional info - it looks like the baseURL might not be getting set correctly anymore. These API calls (both a POST and a GET for system settings, not pictured but the same behavior) are being tacked on to the local frontend path, not the /api/v1 path.

Request headers image

Response headers image

Expected request/response headers Request headers ![image](https://user-images.githubusercontent.com/11774799/105179246-1626de00-5af7-11eb-9461-8867bd00da18.png) Response headers ![image](https://user-images.githubusercontent.com/11774799/105179174-fbed0000-5af6-11eb-8cd1-8e27cae1aadd.png)

Note that I did not see this same behavior from upgrading the AndcultureCode.DotnetReact.Boilerplate project to axios@0.21.1, andculturecode-javascript-core@0.4.2 or andculturecode-javascript-react@0.3.1. That project is much smaller and is using the OSS ServiceFactory, ServiceHookFactory and ServiceUtils exclusively, whereas this client project is leveraging a mix of the three (some of the code has been swapped out for the OSS port, and some hasn't yet)

Going to keep digging.

brandongregoryscott commented 3 years ago

This is likely a non-issue now that we've updated the dependencies to be peer required. The Dotnet/React boilerplate has been updated to axios 0.21.1 and is using both the JS Core + React packages which have the peer dependency updates, and seems to be working just fine. I'll update the dev dependency here and likely close this out