question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.50.0-rc.2 not working with axios in release build

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment: OS: macOS High Sierra 10.13 Node: 8.8.1 Yarn: 1.2.1 npm: 5.4.2 Watchman: 4.9.0 Xcode: Xcode 9.0.1 Build version 9A1004 Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.50.0-rc.2 => 0.50.0-rc.2

Steps to Reproduce

After upgrading my project to RN 0.50.0-rc.2, all axios call stopped working in release build (they work well in development build and RN 0.49.5).

    try {
      const res = await axios.get('/news', {
        params: { limit: 20, offset: 0 }
      })
      console.log(res)
    } catch (error) {
      window.alert(error)
    }

I got this exception: image

This only happens on RN 0.50.0-rc.2 & production build.

After I changed this line in axios to if (true) { then it works again in production build. I don’t know why the assertion failed in production build. When I use window.alert(typeof XMLHttpRequest) in my own code it outputs ‘function’, but it outputs ‘undefined’ in axios code.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

1reaction
Manweillcommented, Nov 9, 2017

@alimek Yes, it’s ok in rn 0.50.3。

1reaction
alimekcommented, Nov 9, 2017

@Manweill in package.json. Anyway you can try update RN to version 0.50.3, they are saying that its fixed, but haven’t tried it yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Axios Post Works In Debug But Gives "Network Error" In ...
If I run the app with the debug build everything works as expected. I can make calls to server with no problem. When...
Read more >
Using Axios to Consume APIs - Vue.js
This will let us know if something failed during the API request, but what if the data is mangled or the API is...
Read more >
React Axios API Requests | Axios with React JS Tutorial
Learn React Axios API Requests in this tutorial. We will implement Axios with React JS as we build our React JS Blog project....
Read more >
React Native API calls with Fetch and Axios - Enappd
We will build a project and along with it learn different methods for API calls including 1) fetch() method and 2) Axios method...
Read more >
axios-mock-adapter - npm
Latest version: 1.21.2, last published: 5 months ago. Start using axios-mock-adapter in your project by running `npm i axios-mock-adapter`.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found