firefox-devtools / vscode-firefox-debug

VS Code Debug Adapter for Firefox
https://marketplace.visualstudio.com/items?itemName=firefox-devtools.vscode-firefox-debug
MIT License
397 stars 66 forks source link

Set default localhost resolution to IPv4 #329

Open sorashi opened 1 year ago

sorashi commented 1 year ago

While Firefox starts its debug server on IPv4 localhost, node defaults to IPv6 ::1 since node 17 (https://github.com/nodejs/node/issues/40537).

For this reason, on newer versions of node, vscode-firefox-debug responds with

Error on launch: connect ECONNREFUSED ::1:6000

This PR changes the default back to where it was before node v17.

This should fix #306

kolchurinvv commented 1 year ago

@sorashi, Hey! pulled your pr into my own fork! thank you so much!

ChrisMSaltire commented 1 year ago

Hopefully we can get a maintainer to merge it in here. Maybe @hbenl? It looks like they have been the primary contributor so far.

sorashi commented 1 year ago

@kolchurinvv No problem, glad it helped.

SanderBouwhuis commented 1 year ago

I started using VS code yesterday and ran into this problem. So, what does this fix do? The VS code extension 'Debugger for Firefox'? Can an update be released which has this fix? Sorry if my comment sounds dumb, but I'm very new to VS code and web development.

kolchurinvv commented 1 year ago

@SanderBouwhuis

Can an update be released which has this fix?

unfortunately, it seems like the answer is no... for now. the repo has been 'on hiatus' for the last year.

So, what does this fix do?

this makes the IPv4 protocol the first protocol which is tried when the connection between node and the FF debugger is tried. the master branch of this repo doesn't have a good fall back when the IPv6 connection throws an error.

what you can do? go to https://github.com/sorashi/vscode-firefox-debug/tree/node-17-fix - the creator of this fix. pull down his repo and checkout the node-17-fix branch. npm i and npm run build (it'll give you a few warnings, but it should compile anyway) locate the .vsix newly compiled file. Before installing from a local file, make sure you've uninstalled the existing FF debugger. Search for a vscode command Install from VSIX in the command pallet and select the .vsix file

i've done a similar thing, with a main difference that i've created my own fork and pulled down the same pr into my forked master branch

pmjobin commented 1 year ago

To add to the above procedure by @kolchurinvv , I needed to run npm run package after npm run build in order to generate the .vsix file in the root folder of the project. I can confirm that once installed, this PR fixed the ERRCONNREFUSED issue I was experiencing in VS Code and I was able to debug using Firefox again.

@sorashi Thank you for fixing this! I hope this PR makes it into the official release.

niklasholm commented 1 year ago

Since 1.18.x rolled out this now affects all users, not only beta/insider users. This extension is broken in it's current state, why is this not merged? Where the hell are the maintainers?

hbenl commented 1 year ago

@sorashi Thanks a lot for the PR, I've incorporated it into #342, now waiting for approval from Mozilla to publish it to the VS Code Marketplace.

hbenl commented 1 year ago

I've just published this in version 2.9.10.