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 in Running Chrome Debug Instance when the Chrome window is open #927

Open
wesleybl opened this issue Oct 27, 2022 · 12 comments
Open

Comments

@wesleybl
Copy link

wesleybl commented Oct 27, 2022

When the Chrome window is open and I try to run Chrome Debug Instance, I get the error:

!ENTRY org.eclipse.wildwebdeveloper 4 0 2022-10-27 11:11:14.029
!MESSAGE Unexpected exception
!STACK 1
org.eclipse.debug.core.DebugException: Unexpected exception
	at org.eclipse.lsp4e.debug.debugmodel.DSPDebugElement.monitorGet(DSPDebugElement.java:100)
	at org.eclipse.lsp4e.debug.debugmodel.DSPDebugTarget.initialize(DSPDebugTarget.java:185)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.createDebugTarget(DSPLaunchDelegate.java:370)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.launch(DSPLaunchDelegate.java:350)
	at org.eclipse.wildwebdeveloper.debug.AbstractHTMLDebugDelegate.launchWithParameters(AbstractHTMLDebugDelegate.java:44)
	at org.eclipse.wildwebdeveloper.debug.chrome.ChromeAttachDebugDelegate.launch(ChromeAttachDebugDelegate.java:43)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:806)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:717)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1021)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1224)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Cannot connect to runtime process, timeout after 10000 ms - (reason: Can't find a valid target that matches: about:blank. Available pages: ["file:///home/s052328876/my-app/node_modules/react-scripts/scripts/start.js"]).
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
	at org.eclipse.lsp4e.debug.debugmodel.DSPDebugElement.monitorGet(DSPDebugElement.java:86)
	... 10 more
Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Cannot connect to runtime process, timeout after 10000 ms - (reason: Can't find a valid target that matches: about:blank. Available pages: ["file:///home/s052328876/my-app/node_modules/react-scripts/scripts/start.js"]).
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
	at org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator.consume(ReflectiveMessageValidator.java:68)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1589)
!SUBENTRY 1 org.eclipse.lsp4e.debug 4 5010 2022-10-27 11:11:14.030
!MESSAGE Unexpected exception
!STACK 0
java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Cannot connect to runtime process, timeout after 10000 ms - (reason: Can't find a valid target that matches: about:blank. Available pages: ["file:///home/s052328876/my-app/node_modules/react-scripts/scripts/start.js"]).
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
	at org.eclipse.lsp4e.debug.debugmodel.DSPDebugElement.monitorGet(DSPDebugElement.java:86)
	at org.eclipse.lsp4e.debug.debugmodel.DSPDebugTarget.initialize(DSPDebugTarget.java:185)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.createDebugTarget(DSPLaunchDelegate.java:370)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.launch(DSPLaunchDelegate.java:350)
	at org.eclipse.wildwebdeveloper.debug.AbstractHTMLDebugDelegate.launchWithParameters(AbstractHTMLDebugDelegate.java:44)
	at org.eclipse.wildwebdeveloper.debug.chrome.ChromeAttachDebugDelegate.launch(ChromeAttachDebugDelegate.java:43)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:806)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:717)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1021)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1224)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Cannot connect to runtime process, timeout after 10000 ms - (reason: Can't find a valid target that matches: about:blank. Available pages: ["file:///home/s052328876/my-app/node_modules/react-scripts/scripts/start.js"]).
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
	at org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator.consume(ReflectiveMessageValidator.java:68)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1589)

The application does not appear, and a blank tab is loaded, at the url "about:blank".

Steps to reproduce:

  1. Create a react application:
npx create-react-app my-app
cd my-app
  1. Create an Eclipse project in my-app folder.
  2. Edit the file my-app/package.json adding the following line to the scripts key:
    "debug": "react-scripts --inspect=127.0.0.1:9222 start"
  1. Start the application with the command:
npm run debug
  1. Access the Eclipse menu:
    Run -> Debug Configurations -> Running Chrome Debug Instance

And create a new configuration.
6. Fill the URL field with: http://localhost:3000
7. Click in Apply
8. Click in Debug

When all Chrome windows are closed, the issue does not occur. However, it is bad to have to close Chrome every time we go to debug.

Refs:

microsoft/vscode-chrome-debug-core#324
https://stackoverflow.com/questions/45592581/cannot-debug-in-vs-code-by-attaching-to-chrome

Environment

Eclipse 4.25.0
Java 18
Ubuntu 22
node 16.17.0
Chrome 105
wildweb 0.15.1

@wesleybl
Copy link
Author

In vscode, the following configuration works:

{
    "configurations": [
        {
            "type": "chrome",
            "name": "http://localhost:3000",
            "request": "launch",
            "url": "http://localhost:3000"
        }
    ]
}

A new Chrome window opens, even if you already have others open.

@mickaelistria
Copy link
Contributor

A contribution that fixes that would be welcome.

@vrubezhny
Copy link
Contributor

@wesleybl Did you tried using Remote Firefox Debugger Debug configuration with this React App?

It looks like Chrome Debug Adapter, for some reason, fails to resolve Tab by address and internally uses the script file path instead of the page address. So it fails finding a correct tab because the script path has nothing common with the URL provided.

@wesleybl
Copy link
Author

wesleybl commented Jan 23, 2023

@vrubezhny using Launch Firefox Debugger, a new Firefox window is opened, even if one is already open. However, it is necessary to press F5 for the breakpoint to work.

There must be a way to make it work in Chrome, since it works in vscode.

@wesleybl
Copy link
Author

wesleybl commented Jun 2, 2023

@vrubezhny but why does it work when Chrome is closed? I went to see how this works in VS Code, and it always opens a new Chrome window, regardless of having an instance of Chrome already open. Shouldn't it be like that here too instead of trying to open a new tab?

@mickaelistria
Copy link
Contributor

There is most likely a way to make things work, but Wild Web Developer first needs to complete #555 to behave more closely to VSCode.

@wesleybl
Copy link
Author

@mickaelistria but shouldn't it work with the current debug? Firefox debug, for example, works with the current debug.

@wesleybl
Copy link
Author

@mickaelistria do you know if PR #1359 will fix this issue?

@mickaelistria
Copy link
Contributor

No, sorry, but I suggest you give it a try yourself; just by installing latest snapshot ;)

@wesleybl
Copy link
Author

I suggest you give it a try yourself; just by installing latest snapshot ;)

@mickaelistria but won't PR #1359 change the way chrome debugging works? Wouldn't it be better to wait for it to be merged?

@mickaelistria
Copy link
Contributor

ah sorry, I thought it was already merged. Thanks for the heads-up!

@mickaelistria
Copy link
Contributor

Snapshots with newer Chrome debug adapter should be available once https://ci.eclipse.org/wildwebdeveloper/job/Wildwebdeveloper/job/master/811/ completes, in ~15 minutes,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants