Skip to content

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

Closed

Description

@onstash

🐛 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

Activity

  1. hramos commented on Mar 1, 2019

    @hramos
    Contributor

    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.

  2. added
    DebuggingIssues related to React Native DevTools or legacy JavaScript/Hermes debugging
    on Mar 1, 2019
  3. onstash commented on Mar 2, 2019

    @onstash
    Author

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

  4. opp100 commented on Mar 3, 2019

    @opp100

    Have you try this.

    #23349 (comment)

  5. onstash commented on Mar 4, 2019

    @onstash
    Author

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

  6. onstash commented on Mar 4, 2019

    @onstash
    Author

    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.

  7. kelset commented on Mar 4, 2019

    @kelset
    Contributor

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

  8. onstash commented on Mar 4, 2019

    @onstash
    Author

    Hi @kelset. Sure. Will do that.

  9. kelset commented on Mar 4, 2019

    @kelset
    Contributor

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

  10. marlon-wiprud commented on Mar 6, 2019

    @marlon-wiprud

    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!

  11. Kendysond commented on Mar 9, 2019

    @Kendysond

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

  12. sunnylqm commented on Mar 20, 2019

    @sunnylqm
    Contributor

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

    react-native-community/cli#253

  13. Gerlison commented on Mar 23, 2019

    @Gerlison

    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

  14. user0604 commented on Mar 26, 2019

    @user0604

    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!

  15. alittletf commented on Jul 17, 2019

    @alittletf

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

  16. DrHrishi commented on Jul 22, 2019

    @DrHrishi

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

  17. stale commented on Oct 20, 2019

    @stale

    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.

  18. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Oct 20, 2019
  19. stale commented on Oct 27, 2019

    @stale

    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.

  20. locked as resolved and limited conversation to collaborators on Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDebuggingIssues related to React Native DevTools or legacy JavaScript/Hermes debuggingPlatform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions