vscode-firefox-debug: Unable to launch/attach Firefox at all on OSX.

I’m trying to go through the Heaps.io ‘hello world’ introduction but use Firefox as my browser and I cannot get VSCode to launch Firefox or attach, despite playing with the settings.

When I try and debug, VSCode just waits for something to happen and then doesn’t load Firefox. I have tried launching the browser via the command line and attaching (using -start-debugger-server) but no luck their either. I have set the debug config options in the browser settings too.

The launch config file is the default one as follows;

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch index.html",
            "type": "firefox",
            "request": "launch",
            "reAttach": true,
            "file": "${workspaceFolder}/index.html"
        },
        {
            "name": "Launch localhost",
            "type": "firefox",
            "request": "launch",
            "reAttach": true,
            "url": "http://localhost/index.html",
            "webRoot": "${workspaceFolder}"
        },
        {
            "name": "Attach",
            "type": "firefox",
            "request": "attach"
        },
        {
            "name": "Launch WebExtension",
            "type": "firefox",
            "request": "launch",
            "reAttach": true,
            "addonPath": "${workspaceFolder}"
        }
    ]
}

VSCode Version: 1.41.1 Commit: 26076a4de974ead31f97692a0d32f90d735645c0

MacOS Version: 10.15.2 (19C57)

Please can someone help me diagnose where the problem lies as i’m unsure of whether it is VSCode, Firefox or the plugin that is causing the issue.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I’ve ran into the same issue during the same tutorial on Windows 10. The haxe language server occupies port 6000 Therefore changing the port of the firefox debugging fixed everything for me

"configurations": [
        {
            "name": "Firefox debug",
            "type": "firefox",
            "port":6060,
            "request": "launch",
            "reAttach": true,
            "file": "${workspaceFolder}/index.html"
        }
    ]

Sorry for my lack of response on this; I haven’t had the time to dig further. I will endeavour to check the port setting, to see if that would have any effect.

Re: sample project, i’m following the ‘hello world’ example over at the Heaps website here; https://heaps.io/documentation/hello-world.html. Only switching the parts about Chrome to use Firefox instead.

Did you also try the port option? If that option is the root cause, it would make sense that Firefox is launched when setting reAttach to false, but debugging would still not work (because VS Code couldn’t connect to the Firefox debugger). Also, do the breakpoints remain gray after launching Firefox (and until the debug session is stopped)? And what is a .hx file? Can you point me to a sample project that uses that kind of file?

it’s almost as if VSCode doesn’t seem to know where Firefox is installed in order to launch the process

if that was the case then the debug adapter would show an error message that it can’t find Firefox…

Perhaps you could share a test project or a sample launch file?

your launch file is correct and the content of the project doesn’t make any difference until Firefox is started and the debugger is attached…

Here’s some more things you could try:

  • try setting reAttach to false in your launch configuration - that changes how Firefox is launched
  • try setting port to a different value (the default is 6000) - perhaps something is occupying that port
  • try setting firefoxExecutable to the path of the Firefox executable (i.e. the path you enter on the command line to start Firefox) - I don’t think that’s the reason but it’s worth trying

Thanks for the response @hbenl but i’m afriad this doesn’t seem like the case. I am not getting any reaction out of VSCode to launch Firefox at all, let alone a second time. My test case involves calling ‘Quit’ from the docker before trying to launch the debug session but it’s almost as if VSCode doesn’t seem to know where Firefox is installed in order to launch the process. I would also note that Firefox isn’t killed should it be running and my debug session is ended. I literally cannot get any response from the App at all; with Chrome it seems to work instantly.

Perhaps you could share a test project or a sample launch file?