React-native: "Error Unauthorized" in the command line after enabling "Remote JS debugging"

Created on 1 Mar 2019  路  17Comments  路  Source: facebook/react-native

馃悰 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

Bug Debugging Android Stale

Most helpful comment

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

All 17 comments

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.

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

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

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.

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

Hi @kelset. Sure. Will do that.

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).

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!

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. 馃槀

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

https://github.com/react-native-community/react-native-cli/pull/253

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

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!

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

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

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phongyewtong picture phongyewtong  路  3Comments

WG-Com picture WG-Com  路  3Comments

aniss picture aniss  路  3Comments

jlongster picture jlongster  路  3Comments

anchetaWern picture anchetaWern  路  3Comments