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

iOS: Connection to development server frequently lost? #12786

Closed
ABleas opened this issue Mar 8, 2017 · 13 comments
Closed

iOS: Connection to development server frequently lost? #12786

ABleas opened this issue Mar 8, 2017 · 13 comments
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@ABleas
Copy link

ABleas commented Mar 8, 2017

On device refresh (shake device > reload), the error "Could not connect to development server" occasionally shows up. At other times, reloading doesn't update the live app, even when code has changed, but no error is thrown.

If I try to run a new server with npm start, it reports that there is already a development server running. I have to stop the server and rerun the app before this resolves.

I was under the impression that we don't need to change jsCodeLocation any more, as those instructions we removed from documentation, and running live through the device works with a fresh RN project.

It happens every hour at least. I can't reliably reproduce it.

Additional Information

Currently using the following modules:

    "lottie-react-native": "1.0.5",
    "react": "15.4.1",
    "react-native": "^0.41.2",
    "react-native-blur": "^2.0.0",
    "react-native-datepicker": "^1.4.2",
    "react-native-maps": "0.13.0",
    "react-native-scrollable-tab-view": "^0.7.2",
    "supercluster": "^2.3.0"

I'm also using a CocoaPods workspace to load google maps dependencies not included with iOS.
This is untested on Android, so just an iOS issue.
Developing on MacOS Sierra 10.12.2.

I realize this may be a troubleshooting issue for my setup but as the instability only began after RN^40, I'm wondering, am I alone with this?

@MattyK14
Copy link

MattyK14 commented Mar 9, 2017

You are not alone.

RN: 0.41.2
iOS 10.2.1
Mac Sierra 10.12.3

@ABleas
Copy link
Author

ABleas commented Mar 15, 2017

Further testing shows this issue doesn't seem to appear on Android devices. I have a server running and can connect with my Android device, while iOS fails to connect after a certain time, even after re-running a server.

@shergin shergin added the Platform: iOS iOS applications. label Mar 16, 2017
@ABleas
Copy link
Author

ABleas commented Mar 16, 2017

I am not sure about the instructions in this output:

URL: http://192.168.100.14.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false
2017-03-16 15:54:07.251243 Oreal[3609:8148924] Could not connect to development server.

Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate

Node server URL does not appear in AppDelegate (any more), and I can't find instructions to do this. Is there possibly a fix without rerunning the app? Could this resolve with an upgrade?

@flybayer
Copy link

Same here!

It randomly stops working, even though my IP addresses are correct and not changing.

Usually if I wait a minute or so, I can tap Reload, and then it'll start working fine for another 30-60mins.

facebook-github-bot pushed a commit that referenced this issue Apr 8, 2017
Summary:
When running an app on a real iPhone in debug mode, I occasionally get issues when trying to load the js bundle and I suspect the issue is with xip.io (and it doesn't look like I'm the only one: #12786 #9688 (comment)). So I've added the ability to optionally disable the use of xip.io if an env variable `DISABLE_XIP` is set.

Add `export DISABLE_XIP=true` to the `Bundle React Native code and images` build phase. Run the app on a real iPhone and ensure that it can load the JS bundle from the host computers IP.
Closes #13326

Differential Revision: D4855719

Pulled By: ericvicenti

fbshipit-source-id: cb2e91291acadaa78ea302800b55c2e5388f6380
facebook-github-bot pushed a commit to facebook/metro that referenced this issue Apr 8, 2017
Summary:
When running an app on a real iPhone in debug mode, I occasionally get issues when trying to load the js bundle and I suspect the issue is with xip.io (and it doesn't look like I'm the only one: facebook/react-native#12786 facebook/react-native#9688 (comment)). So I've added the ability to optionally disable the use of xip.io if an env variable `DISABLE_XIP` is set.

Add `export DISABLE_XIP=true` to the `Bundle React Native code and images` build phase. Run the app on a real iPhone and ensure that it can load the JS bundle from the host computers IP.
Closes facebook/react-native#13326

Differential Revision: D4855719

Pulled By: ericvicenti

fbshipit-source-id: cb2e91291acadaa78ea302800b55c2e5388f6380
thotegowda pushed a commit to thotegowda/react-native that referenced this issue May 7, 2017
Summary:
When running an app on a real iPhone in debug mode, I occasionally get issues when trying to load the js bundle and I suspect the issue is with xip.io (and it doesn't look like I'm the only one: facebook#12786 facebook#9688 (comment)). So I've added the ability to optionally disable the use of xip.io if an env variable `DISABLE_XIP` is set.

Add `export DISABLE_XIP=true` to the `Bundle React Native code and images` build phase. Run the app on a real iPhone and ensure that it can load the JS bundle from the host computers IP.
Closes facebook#13326

Differential Revision: D4855719

Pulled By: ericvicenti

fbshipit-source-id: cb2e91291acadaa78ea302800b55c2e5388f6380
@hramos hramos added the Icebox label Jul 25, 2017
@hramos
Copy link
Contributor

hramos commented Jul 25, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos closed this as completed Jul 25, 2017
@OrianeInMoon
Copy link

still happens

@tybro0103
Copy link

It's because of the use of xip.io. Latest RN includes a way to disable it.

I like to setup a VPN (ZeroTier) on both mac and iphone and hardcode my VPN IP in that build script (node_modules/react-native/scripts/react-native-xcode.sh). This way I don't have to build from Xcode whenever my IP changes. But it is pretty hacky cuz it'll get over-written since it's in node_modules. Might be worth opening a PR have react-native-xcode.sh try to use a DEV_IP ENV var.

@selsamman
Copy link

selsamman commented Aug 22, 2017

This error occurs for many reasons. Thanks @tybro0103 for adding the fact that the build script adds xip.io to the ip address. xip.io does not work on many routers and you are left scratching your head because the error message is misleading and does not report the actual address being used. So to see if that is your problem just nslookup myipaddress.xip.io. If it does not resolve then you need to, as the PR suggests add DISABLE_XIP to shell script script for bundle react native code and images. image

@henrikra
Copy link

henrikra commented Oct 4, 2017

Thanks @tybro0103 and @selsamman I was struggling with this for weeks... :D

@tybro0103
Copy link

Might be worth mentioning the reason I discovered this...

With xip.io, things worked about 90% of the time for me. But when it started failing would take me ~10 minutes to get it to work again... pretty disruptive thing to deal with while working on an app. Don't know why the xip.io address would sometimes be fine and sometimes not, but that was the case even at home (not a corporate network), but things work all of the time without xip.io.

@henrikra
Copy link

henrikra commented Oct 4, 2017

Yeah for me it worked at home too but not at the office. So are corporate networks different somehow?

@selsamman
Copy link

It is not clear to me why xip.io should be on by default. The whole package manager interface is pretty fragile and having one more banana peel just doesn't make sense to me. Maybe I am missing something about why xip.io is needed in the first place for this use-case.

In my case I travel a fair bit and each time and it is always aggravating getting things going again on a new network. Often I just use my phone as a hot spot just avoid this. The xip.io problem I found on only one router in my travels. It is not clear though whether it was the router or the service provider that was the source of the problem.

@henrikra
Copy link

henrikra commented Oct 4, 2017

@selsamman Check this comment why they use xip.io #8850 (comment)

@facebook facebook locked as resolved and limited conversation to collaborators Jul 25, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

10 participants