-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Local Fetch GET Network Request Failing #18432
Comments
Thanks for posting this! It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out? If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label. Thank you for your contributions. |
Thanks for posting this! It looks like your issue may be missing some necessary information. Can you run Thank you for your contributions. |
If you trying to access localhost, you'll need to put your ip address from experience. This post should help explain why - #10404 (comment). |
This issue looks like a question that would be best asked on Stack Overflow. Stack Overflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on Stack Overflow. |
I'm having this same issue (using the Expo app on an iPhone 7 Plus). My Everything works on Simulator on my MacBook Pro (didn't even have to change to
when trying to run on my iPhone. Suggestions? |
@yoaquim did you ever solve your issue? Im using what I thought to be the proper IPv4 # instead of localhost but I still get network request errors |
Description
I'm trying to fetch data from my local api's & getting "Network Request Failed". These API's are working fine on POSTMAN. If i replace this URL with url given in [https://facebook.github.io/react-native/docs/network.html], this code works.
componentDidMount(){ return fetch("https://api.kashu.com:4002/api/HomeData/1",{ method: 'GET', headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'x-ibm-client-id' : 'default', 'x-ibm-client-secret': 'SECRET' } }) .then((response) => response.json()) .then((responseJson) => { alert(responseJson); this.setState({ isLoading: false, dataSource: responseJson, }, function(){ }); }) .catch((error) =>{ console.error(error); }); }
Actual Response if API is run by POSTMAN or any client
{ "data": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", "id": 1 }
Environment
Environment: OS: Windows 10 Node: 8.10.0 Yarn: Not Found npm: 4.6.1 Watchman: Not Found Xcode: N/A Android Studio: Not Found Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.52.0 => 0.52.0
Platform: Testing App on iPhone6 using Expo Client
API : Loopback API's hosted on same local system, changed hostname - api.kashu.com(pointed to 127.0.0.1)
Steps to Reproduce
Expected Behavior
Actual Behavior
Tried to make GET Request to Local Loopback.js API from 0.54 version of React Native & React native threw Network Error.
iOS 6(Expo Client) Error Information -
The text was updated successfully, but these errors were encountered: