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

"Error Unauthorized" in the command line after enabling "Remote JS debugging" #23719

Closed
onstash opened this issue Mar 1, 2019 · 17 comments
Closed
Labels
Bug Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@onstash
Copy link

onstash commented Mar 1, 2019

🐛 Bug Report

I am getting "Error Unauthorized" in the command line after enabling "Remote JS debugging". This is from a freshly installed react-native v0.58.6.

screenshot 2019-03-01 at 23 21 58

To Reproduce

react-native start
react-native run android
Enable Hot Reloading
Enable Live Reload
Enable JS Debugging

Expected Behavior

Chrome tab should open Chrome debugger
App should not display a white screen & command line should not show "Error unauthorized"

Code Example

Default app of a freshly installed react-native v0.58.6. Not sure what I can reproduce here.

Environment

React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 35.32 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.12.0 - /usr/local/bin/node
Yarn: 1.12.3 - ~/.yarn/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3
IDEs:
Android Studio: 3.1 AI-173.4720617
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.58.5 => 0.58.5
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

@hramos
Copy link
Contributor

hramos commented Mar 1, 2019

Can you try using Safari for debugging? A JSI for debugger for Chrome is currently being worked on, but for now Safari is your best bet for remote debugging.

@hramos hramos added the Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging label Mar 1, 2019
@onstash
Copy link
Author

onstash commented Mar 2, 2019

Similar end result. Mobile app screen is stuck at "Connecting to remote debugger".

@opp100
Copy link

opp100 commented Mar 3, 2019

Have you try this.

#23349 (comment)

@onstash
Copy link
Author

onstash commented Mar 4, 2019

Hey @opp100. I tried that comment. It is not working as expected. I am getting the same error.

@onstash
Copy link
Author

onstash commented Mar 4, 2019

Not sure how this issue is going to be fixed. I downgraded to 0.57.2 and things are working. Would close this issue if it's OK with you guys.

@kelset
Copy link
Contributor

kelset commented Mar 4, 2019

Can you tried init'ing a project with the latest rc for 0.59? And report if it's happening there too?

@onstash
Copy link
Author

onstash commented Mar 4, 2019

Hi @kelset. Sure. Will do that.

@kelset
Copy link
Contributor

kelset commented Mar 4, 2019

Ok, actually I may have an idea - are you using an Emulator or device running Android 9?

Because in that case you can simply add this line to your manifest as workaround. A proper fix is already in place for 0.59 (refer to this conv).

@marlon-wiprud
Copy link

Having the same issue. Debugging works on IOS simulator, but does not work on real IOS device. React native version: 0.58.6.

Error: unauthorized.

Any ideas greatly appreciated!

@Kendysond
Copy link

Kendysond commented Mar 9, 2019

For more context for anyone that would like to help look into this.

In my case, this error only came up after I setup my phone on Xcode and ran my app on my phone.

Whenever you run your app on your phone, your debug URL will be your system IP:8081 e.g http://192.168.122.112:8081/debugger-ui/ as opposed to the typical localhost i.e http://127.0.0.1:8081/debugger-ui/ that the simulator uses.

PS: This error goes away if you disable JS debugging on the simulator iPhone.

That being said, after I was done testing with my phone and went back to my simulator, my debugger IP was still my system IP, and I think that's the source of this Unauthorized error.

I hope this helps someone help us with solution. 😂

@dulmandakh dulmandakh added the Platform: Android Android applications. label Mar 17, 2019
@sunnylqm
Copy link
Contributor

I found that some chrome extensions may contain custom orgin in headers, which would trigger this error.

react-native-community/cli#253

@Gerlison
Copy link

Gerlison commented Mar 23, 2019

I was with the same error. For me worked change the url in chrome from 192.168.0.xxx:8081/debugger-ui to localhost:8081/debugger-ui. This happened when i was using Live Reload to run my app in a real device. I hope this help you

@user0604
Copy link

I found that some chrome extensions may contain custom orgin in headers, which would trigger this error.

react-native-community/react-native-cli#253

Thank you! I had this exact problem, then I disabled the "Allow-Control-Allow-Origin" chrome extension and that solved it!

@alittletf
Copy link

Anyone who might come across this, I also encountered the Error: Unauthorized from Metro Bundler. I just restarted my computer and everything worked perfectly.

@DrHrishi
Copy link

DrHrishi commented Jul 22, 2019

Disable all chrome CORS extensions, and then try :-)

@stale
Copy link

stale bot commented Oct 20, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 20, 2019
@stale
Copy link

stale bot commented Oct 27, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Oct 27, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests