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

remote debugging when running server on different port #12527

Closed
ConnorMWGraham opened this issue Feb 22, 2017 · 6 comments
Closed

remote debugging when running server on different port #12527

ConnorMWGraham opened this issue Feb 22, 2017 · 6 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@ConnorMWGraham
Copy link

Description

I am running my server with "react-native start --port 9090". I can not use port 8081. Enabling Remote JS Debugging from my android emulator produces the following error:
image
The error seems to be easy to understand. It is trying to load a resource from localhost:8081, but can't find it because my server is running on port 9090

Reproduction

  1. Start react-native server on different port "react-native start --port 9090"
  2. Customize emulator to use port 9090 - ctrl+M > Dev Settngs > Debug server host & port for device >"10.0.2.2:9090"
  3. Enable remote debugging - ctrl+M > Debug JS Remotely

Additional Information

  • React Native version: 0.41.2
  • Platform: Android
  • Operating System: Windows
  • Default Browser: Chrome
@brentvatne
Copy link
Collaborator

@ConnorMWGraham - did you rebuild the client using react-native run-android after changing the port?

@ConnorMWGraham
Copy link
Author

No. I thought I had adjusted the client appropriately by doing ctrl+M > Dev Settngs > Debug server host & port for device >"10.0.2.2:9090". Where can I find the appropriate client configuration file?

@chmurson
Copy link

Same issue here. I have to run packager on different port since 8081 is already taken by McAfee processes ( cannot change that easily :( ). Everything works fine when I change host & port device via "in-app menu" (CMD+M). However it returns same error as in issue description when I turn on the remote debugger.

@anders-g-hansen
Copy link

I believe that #12095 which has a PR that has not yet been merged will partially fix the issue. I am able to work around this currently by setting a breakpoint in debuggerWorker.js and changing the port on the message.url before continuing (see screenshot). This is a painful work around, but until that PR is merged, not sure there is a better option.

debuggerworker js

However, I also needed to update the RealmReactModule.java file to change the hard coded port set for the Access-Control-Allow-Origin header to be the custom port I'm using (8088). Otherwise I get CORS errors.

            Response response = newFixedLengthResponse(jsonResponse);
            response.addHeader("Access-Control-Allow-Origin", "http://localhost:8088");
            return response;

After doing these two things, I was able to get the remote debugging to work.

@Rovack
Copy link

Rovack commented Mar 4, 2017

See #9935.

@hramos
Copy link
Contributor

hramos commented May 22, 2017

Solved in #12095

@hramos hramos closed this as completed May 22, 2017
@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants