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

TypeError: axios.create is not a function error #316

Open
akshaymohana-btc opened this issue Jul 31, 2023 · 3 comments
Open

TypeError: axios.create is not a function error #316

akshaymohana-btc opened this issue Jul 31, 2023 · 3 comments

Comments

@akshaymohana-btc
Copy link

After upgrading apisauce to latest(3.0.1) version I got TypeError: axios.create is not a function error.

Issue: Apisauce was failing to create ApisauceInstance using create function.
Fix: After downgrading apisauce to 3.0.0 version works in normal way.

@JohnieXu
Copy link

JohnieXu commented Aug 5, 2023

I also encountered the same error and found that axios is a string after troubleshooting.
image
webpack 5.88
apisauce 3.0.1
node.js 16.13

image image

After webpack bundling, the axios is compiled into:
image

I suspect it could be an issue with how webpack handles dependencies or there might be an issue with the exports in the axios package's configuration file.
image

@Taelar
Copy link

Taelar commented Aug 7, 2023

Same problem here while upgrading from 2.0 to 3.0.1 on a Create React App project (webpack). It seems to be a problem with a certain version of axios that does not export properly the create() function, see axios/axios#5613 and axios/axios#5038. I'm very interested in any workaround. 🙏

@JohnieXu
Copy link

JohnieXu commented Aug 8, 2023

The apisauce@3.0.1 udpdate axios to ^1.4.0 caused this problem, It appears to be a problem with create-react-app, as described in this GitHub issue: facebook/create-react-app#11889.

Since the issue is still open, some fixed pull requests have been submitted, but create-react-app (cra) has not yet adopted them.

It may be necessary to revert to apisauce@3.0.0 until the aforementioned GitHub issue is resolved. In apisauce@3.0.0, axios@0.27.2 is used, which does not have this problem.

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

3 participants