8000 Incompatible with React Native 0.79.0 and Expo 53.0.0 - `axios` dependency · Issue #331 · infinitered/apisauce · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Incompatible with React Native 0.79.0 and Expo 53.0.0 - axios dependency #331

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

Open
ChristopherGabba opened this issue Apr 14, 2025 · 18 comments

Comments

@ChristopherGabba
Copy link

I tried upgrading my app to the latest and greatest just to do a dependency test on the new architecture and apisauce blocked the build, no matter what I messed with. I tried yarns resolutions, etc and it never would compile.

It seems to be related to dependencies of axios - crypto, url, etc. and not being compatible with node.

@ChristopherGabba
Copy link
Author

Related: #329

@ChristopherGabba ChristopherGabba changed the title Incompatible with React Native 0.79.0 and Expo 53.0.0 Incompatible with React Native 0.79.0 and Expo 53.0.0 - axios dependency Apr 14, 2025
@jamonholmgren
Copy link
Member

Probably just need to upgrade axios. Will look into this shortly.

@ChristopherGabba
Copy link
Author

Sounds good, let me know if you need anything!

@lvlrSajjad
Copy link

I tried upgrading axios manually but I am still getting this error.
The interesting point is my IDE finds the crypto when I command click but when getting compiled it doesn't include crypto properly.

@robinheinze
Copy link
Member

@ChristopherGabba Is the issue only when building against the NA?

@ChristopherGabba
Copy link
Author

@robinheinze if by NA you mean New Architecture (I had to ask gpt lol), I have not tried bumping to 0.79.0 and Expo 53 on old architecture yet. It is for sure present on the new architecture, but I can test on old tomorrow and get back to you.

@robinheinze
Copy link
Member

Haha, sorry 😅 Based on some digging I think it's affecting both.. It's an axios breaking change introduced in 1.8.0. There's currently a PR that is open but not merged. axios/axios#6802.

Seems like for now the best solution is to pin the Axios version to 1.7.9 #329 (comment)

@robinheinze
Copy link
Member

Once that PR is merged, we'll update the dependencies to the new version.

@ChristopherGabba
Copy link
Author

Okay, yeah seems like it! I just tested it on my end with OA (lol) and I get the exact same error:

Image

When I put a resolution and pin it to 1.7.9, I think I get the same error, except the "crypto" library is replaced with a library called "url". I may be wrong, but that's what I remember too.

@robinheinze
Copy link
Member
8000

From the IR community Slack:

Image

@andidev
Copy link
andidev commented Apr 24, 2025

So have some more info on this I think.
Issue is a bit strange.

  1. If I create a new react native project and use axios itself projects builds without any polyfill needed to be added.
  2. If I copy paste the source code from lib/apisauce.ts into my project and use it directly instead of installing apisauce with npm projects builds without any polyfill needed to be added.
  3. If I use apisauce installed with npm install I get issue and need to add polyfills for at least crypto, url, http, https and probably more into metro.config.js. I used
    resolver: {
        extraNodeModules: require('@pagopa/react-native-nodelibs'),
    },

which adds a lot of polyfills but I still cannot get it to work since its impossible to polyfill all without an error in the polyfill itself.

So why does 1. and 2. work and why does 3. require lots of polyfills?

@robinheinze
Copy link
Member

@andidev That's great info. I'll dig in a bit more to see why that might be.

@robinheinze
Copy link
Member

There is also a new related issue filed on Axios axios/axios#6899

@ChristopherGabba
Copy link
Author

Thanks guys for looking into this. This is the last hurdle for me to get to expo 53, so hopefully someone with axios gets a handle on it...

@robinheinze
Copy link
Member

Here's another workaround from a metro issue facebook/metro#1272 (comment). As soon as there's a stable fix in Axios we'll release a new version.

@vishva-simform
Copy link

Is there any update on this issue? I'm experiencing the same problem after upgrading my SDK to 53 and React Native to 0.79.
For reference, here are the relevant dependencies from my package.json:
"apisauce": "^3.1.1",
"axios": "^1.9.0"

Image

@foresthuo
Copy link

@robinheinze Hi, axios has fixed the problem in 1.8.1, could you please to release a new version? Our project is blocked by this problem. Thanks.

Image

@robinheinze
Copy link
Member
robinheinze commented May 13, 2025

@foresthuo 1.8.1 has been out for a while and other folks in this thread have said in this thread it doesn't solve the issue. @vishva-simform is on 1.9.0 for example and is still facing it.

There are workarounds that others have said successfully unblocked them if you read through the comments here axios/axios#6899 (comment)

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

7 participants
0