vscode-react-native icon indicating copy to clipboard operation
vscode-react-native copied to clipboard

[Bug] Using debugger via attach to Hermes won't work when Flipper's Hermes Debugger is opened with it

Open thisisgit opened this issue 3 years ago • 2 comments

🐛 What is the bug? How can we reproduce it?

I faced this issue while trying to attach debugger on running physical device. Since attaching to Hermes application required address and port, what I did was to:

  1. Open Flipper
  2. Go to Hermes Debugger (RN) tab
  3. Check address:port written there: shot2

Now while Hermes Debugger (RN) tab opened, running Attach to Hermes application on VSCode throws weird warning error like this:

WARN  Already connected: 29
WARN  Not connected to page: 29 , failed trying to handle event: {"id":1002,"method":"NodeWorker.enable","params":{"waitForDebuggerOnStart":true}}
WARN  Not connected to page: 29 , failed trying to handle event: {"id":1003,"method":"Debugger.enable","params":{}}

Although those error popped up, I continued with debugging since bottom bar turned orange: shot3

But adding breakpoint would say Unbound breakpoint and won't work.

Expected behavior

Well, I now know that opening Hermes Debugger tab in Flipper was causing the issue but took me some time before I was able to figure out the cause. I was expecting it to not connect at all if I would not be able to use any of the debugger function from the IDE. But since it was connected and says Unbound breakpoint, I suspected configurations in launch.json and changed settings there (sourceMaps, address, port, etc.) to make breakpoint work. I think it would be better if more clear error message is shown to the user.

Environment

  • npx react-native doctor or npx expo doctor if your project is using Expo:
Common
 ✓ Node.js
 ✓ yarn
 ✓ Watchman - Used for watching changes in the filesystem when in development mode

Android
 ✓ JDK
 ✓ Android Studio - Required for building and installing your app on Android
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 30.0.2
 ✖ ANDROID_HOME

iOS
 ✓ Xcode - Required for building and installing your app on iOS
 ✓ CocoaPods - Required for installing iOS dependencies
 ✓ ios-deploy - Required for installing your app on a physical device with the CLI
  • envinfo:
System:
    OS: macOS 11.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 477.10 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.1.0 - ~/.nvm/versions/node/v16.1.0/bin/node
    Yarn: 1.22.11 - ~/.nvm/versions/node/v16.1.0/bin/yarn
    npm: 7.19.1 - ~/.nvm/versions/node/v16.1.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.2 - /usr/local/bin/pod
    Homebrew: 3.3.9 - /usr/local/bin/brew
    pip3: 21.3.1 - /usr/local/bin/pip3
    RubyGems: 3.0.3 - /usr/bin/gem
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Nano: 2.0.6 - /usr/bin/nano
    VSCode: 1.63.2 - /usr/local/bin/code
    Vim: 8.2 - /usr/bin/vim
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  • React Native Tools extension version: v1.8.1

thisisgit avatar Jan 05 '22 06:01 thisisgit

Hello @thisisgit, thanks for reporting!

We fixed the problem for iOS in master. Android fix is left to be done, because of bug in React Native.

Leaving the issue open to track the progress of Android fix.

Heniker avatar Jan 24 '22 12:01 Heniker

This issue is still existing on Android, keep tracking. Create new issue in RN repo since the previous one is closed. https://github.com/facebook/hermes/issues/792

EzioLi01 avatar Aug 01 '22 06:08 EzioLi01

Confirm with meta team, this issue may not plan to fix so far. Will close this issue and add it into known issue: #1266 .

EzioLi01 avatar Jan 18 '23 05:01 EzioLi01