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

App hangs on http request using axios, but works on "Debug JS remotly" #21892

Closed
ghost opened this issue Oct 22, 2018 · 6 comments
Closed

App hangs on http request using axios, but works on "Debug JS remotly" #21892

ghost opened this issue Oct 22, 2018 · 6 comments
Labels
🌐Networking Related to a networking API. Platform: iOS iOS applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@ghost
Copy link

ghost commented Oct 22, 2018

Hi!
I'm having problems to perform any http request using axios to a local server:
axios.post(url, data)

and for url I tried:
url = "http://localhost:3000/authenticate"
url = "http://127.0.0.1:3000/authenticate"
url = "http://192.168.1.10:3000/authenticate" //server ip address
url = "http://10.0.2.2:3000/authenticate" //emulator address

and NONE of them worked...

The funny thing (and I can't understand why) is that as soon as "Debug JS Remotely" the following url worked perfectly:
url = "http://10.0.2.2:3000/authenticate" //emulator address

So, how should it be my set up to make this work without debugging js remotely??


Trying this on a android device.

"dependencies": {
"axios": "^0.18.0",
"babel-eslint": "^8.0.2",
"country-data": "0.0.31",
"hoist-non-react-statics": "^3.0.1",
"libphonenumber-js": "^1.4.3",
"native-base": "^2.7.2",
"prop-types": "^15.6.0",
"react": "16.3.1",
"react-native": "~0.52.2",
"react-native-animatable": "^1.2.4",
"react-native-cli": "^2.0.1",
"react-native-contacts": "^2.2.2",
"react-native-easy-toast": "^1.1.0",
"react-native-elements": "^0.19.1",
"react-native-google-places-autocomplete": "^1.3.9",
"react-native-keyboard-aware-scroll-view": "^0.4.1",
"react-native-linear-gradient": "^2.3.0",
"react-native-maps": "^0.21.0",
"react-native-navigation": "^1.1.479",
"react-native-scrollable-tab-view": "^0.8.0",
"react-native-splash-screen": "^3.1.1",
"react-native-tab-view": "^1.0.2",
"react-native-toaster": "^1.2.2",
"react-native-vector-icons": "^5.0.0",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.2.0",
"tinycolor2": "^1.4.1"
}

@react-native-bot react-native-bot added 🌐Networking Related to a networking API. Platform: iOS iOS applications. labels Oct 22, 2018
@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. 📋No Template labels Oct 22, 2018
@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.

@saleem-hadad
Copy link

stupid bot -_-

@saleem-hadad
Copy link

@fedecryto did you solve this issue?

@DaveMariner
Copy link

@fedecryto, @saleem-hadad

I just found and fixed this issue in my project - a nightmare to track down! This is probably be a bit late for you, but hopefully not for others.

Turns out that I was using Basic Authentication, and btoa isn't defined in RN except when you're using remote debugging. There's a good explanation here:

https://stackoverflow.com/questions/42829838/react-native-atob-btoa-not-working-without-remote-js-debugging

The "js is actually running in chrome with remote debug" aspect of this should (IMHO) really be highlighted more, preferably with big blink tags in the documentation.

Hope this helps....someone.

@Deepaknathtiwari
Copy link

Downgrade your axios version to 0.18.0.

@facebook facebook locked as resolved and limited conversation to collaborators Oct 22, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🌐Networking Related to a networking API. Platform: iOS iOS applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants