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

Axios undefined timeout will hit exception on Android #1938

Closed
isaaclem opened this issue Dec 27, 2018 · 1 comment · Fixed by #3771
Closed

Axios undefined timeout will hit exception on Android #1938

isaaclem opened this issue Dec 27, 2018 · 1 comment · Fixed by #3771
Projects
Milestone

Comments

@isaaclem
Copy link

isaaclem commented Dec 27, 2018

Summary

Not sure if this is bug or feature request.

      const ax = axios.create({
        timeout: TIMEOUT_CONNECT,
        headers: {
          'Content-Type': 'application/json; charset=utf-8',
          Authorization: `Bearer ${token}`
        }
      });

       ax.post(urljoin(API_BASE_UR), { data: fields })
          .then(({ data }) => {
            console.log('success');
          })

The above code has no problem on iOS, but on Android, it will hit exception if TIMEOUT_CONNECT is undefined. I understand that the value shouldn't be undefined in the first place but I believe the library should provide a default value for Android to handle.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference

Context

  • "axios": "^0.18.0"
 React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
      Memory: 34.87 MB / 8.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 11.0.0 - /usr/local/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 23.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.1, 28.0.2
        System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom_64, android-26 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5014246
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: 0.57.8 => 0.57.8
    npmGlobalPackages:
      react-native-git-upgrade: 0.2.7
@isaaclem isaaclem changed the title Axios undefined timeout will hit exception Axios undefined timeout will hit exception on Android Dec 27, 2018
@jasonsaayman
Copy link
Member

Please check if this has been fixed with #3694

@jasonsaayman jasonsaayman added this to To do in v0.22.0 via automation Apr 29, 2021
@jasonsaayman jasonsaayman added this to the v0.22.0 milestone Apr 29, 2021
@jasonsaayman jasonsaayman linked a pull request Apr 29, 2021 that will close this issue
v0.22.0 automation moved this from To do to Done Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v0.22.0
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants