-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Axios timeout when posting to API on remote server (Only on Android device) #28739
Copy link
Copy link
Closed
Labels
Needs: Author FeedbackNeeds: Environment InfoPlease run `react-native info` and edit your issue with that command's output.Please run `react-native info` and edit your issue with that command's output.Newer Patch AvailablePlatform: AndroidAndroid applications.Android applications.Platform: iOSiOS applications.iOS applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.Type: QuestionIssues that are actually questions and not bug reports.Issues that are actually questions and not bug reports.
Metadata
Metadata
Assignees
Labels
Needs: Author FeedbackNeeds: Environment InfoPlease run `react-native info` and edit your issue with that command's output.Please run `react-native info` and edit your issue with that command's output.Newer Patch AvailablePlatform: AndroidAndroid applications.Android applications.Platform: iOSiOS applications.iOS applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.Type: QuestionIssues that are actually questions and not bug reports.Issues that are actually questions and not bug reports.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Description
We have a backend that is connecting to a SOAP server and translating it to REST. The SOAP server can only be connected via VPN.
When running backend on local, API calls work fine both on Emulator and Android device.
But when we deployed the backend on a remote server, the Android device timeout (15 seconds) when trying to make a request.
Environment
npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.4 => 0.61.4 npmGlobalPackages: react-native-cli: 2.0.1Expected Behavior
Axios resolves the post request without timing out.
Couple of suggested solutions online that I tried, and still got nothing working, were:
1. Create
network_security_config.xmland link it onAndroidManifest.xmlwithandroid:networkSecurityConfig="@xml/network_security_config".I also tried the solution below without the
base-config, having justdomain-config2. Adding both
android:usesCleartextTraffic="true"tools:targetApi="28"/tools:targetApi="29"toapplicationtag inAndroidManifest.xml. Also tried just addingandroid:usesCleartextTraffic="true"without thetools:targetApi3. Tried adding
xmlns:tools="http://schemas.android.com/tools"android:targetSandboxVersion="1"to the root element ofAndroidManifest.xmlKeep in mind I do have both
<uses-permission android:name="android.permission.INTERNET" />and<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />in myAndroidManifest.xmlAgain the request only timeout when trying to post to remote server on an IP address, and it only doesnt work on Android device, everything works fine on Emulator.
Please help, Im not sure what to try anymore!