vscode-firefox-debug icon indicating copy to clipboard operation
vscode-firefox-debug copied to clipboard

Connection refused while using Nvim DAP

Open joshpetit opened this issue 2 years ago • 7 comments

Hey! I'm trying to debug in firefox, but every time I try running I receive this error: Error on launch: connect ECONNREFUSED ::1:6000 I verified the debug server is running on port 6000 by running lsof -i 6000 and my configuration looks like this:

dap.adapters.firefox = {
	type = "executable",
	command = "node",
	args = { os.getenv("HOME") .. "/apps/vscode-firefox-debug/dist/adapter.bundle.js" },
}

Then the launch configuration:

	{
		name = "Debug with Firefox",
		type = "firefox",
		request = "launch",
		reAttach = true,
		url = "http://localhost:3000",
		webRoot = "${workspaceFolder}",
		firefoxExecutable = "/usr/bin/firefox",
	},

I have all the necessary about:config variables set, but the connection is always refused, is there something I have to change?

joshpetit avatar Nov 15 '22 15:11 joshpetit

After tinkering around a bit, I found that after launching, I can connect to the server with the attach configuration:

{
        name = "Debug with Firefox - Attach",
        type = "firefox",
        request = "attach",
        reAttach = true,
        host = "127.0.0.1",
        url = "http://localhost:3000",
        webRoot = "${workspaceFolder}",
},

I can access the repl, but setting breakpoints doesn't do anything (it does display an "R" in the column as opposed to a B in other debuggers).

joshpetit avatar Nov 16 '22 12:11 joshpetit

I've had the same experience as you, have you come around this issue? @joshpetit

andresestrella avatar Mar 15 '23 22:03 andresestrella

I've had the same experience as you, have you come around this issue? @joshpetit

Sadly no, I couldn't find a work around, but the debugger in the Firefox console works so you can step through that, but not in your preferred editor.

joshpetit avatar Mar 16 '23 01:03 joshpetit

@joshpetit @andresestrella I had the same problem. Try an older version of node. lts/gallium (v16.19.1) worked for me, while stable (v19.0.0) did not.

I think the issue is newer node versions default requests to IPv6 (::1 is the IPv6 loopback), but Firefox opens the port 6000 on IPv4.

sorashi avatar Mar 30 '23 20:03 sorashi

After tinkering around a bit, I found that after launching, I can connect to the server with the attach configuration:

{
        name = "Debug with Firefox - Attach",
        type = "firefox",
        request = "attach",
        reAttach = true,
        host = "127.0.0.1",
        url = "http://localhost:3000",
        webRoot = "${workspaceFolder}",
},

I can access the repl, but setting breakpoints doesn't do anything (it does display an "R" in the column as opposed to a B in other debuggers).

With firefox-developer-edition -start-debugger-server and this configuration I'm able to run the debugger but as you said breakpoints doesn't do anything.

hartontw avatar Apr 19 '23 23:04 hartontw

Is there a fix for this? I started using VS code yesterday and immediately ran into this problem.

SanderBouwhuis avatar Sep 19 '23 09:09 SanderBouwhuis

@SanderBouwhuis

Is there a fix for this? I started using VS code yesterday and immediately ran into this problem.

fix https://github.com/firefox-devtools/vscode-firefox-debug/issues/306#issuecomment-1490922655 PR https://github.com/firefox-devtools/vscode-firefox-debug/pull/329

sorashi avatar Sep 20 '23 14:09 sorashi