microsoft/vscode-chrome-debug-core

Error "Can't find a target that matches: about:blank" when using url in launch.json

burdeasa opened this issue · 1 comments

I am attempting to debug an electron app using the following launch.json config below. This has worked until recently; now it fails with

Cannot connect to the runtime process, timeout after 30000 ms - (reason: Can't find a target that matches: about:blank. Available pages:
["file:///C:/source/Stealth/aware/trunk/git/insight/index.html"])

The config:

        {
            "name": "VSCode Debugger",
            "type": "chrome",
            "request": "launch",
            "runtimeExecutable": "${workspaceFolder}/launchElectron",
            "windows": {
                "runtimeExecutable": "${workspaceFolder}/launchElectron.cmd"
            },
            "runtimeArgs": [
                "start",
                "vsCodeDebug",
            ],
            "timeout": 30000,
            "port": 9222,
            "webRoot": "${workspaceFolder}",
            // "urlFilter": "*index.html",
            "url": "file:///${workspaceFolder}/index.html",
            "sourceMaps": true,
            "smartStep": true,
            "internalConsoleOptions": "openOnSessionStart",
            "trace": true,
            "skipFiles": [
                "node_modules/**"
            ],
            "sourceMapPathOverrides": {
                "webpack:///*": "${webRoot}/*"
            }
        },

If I comment out the url and use urlFilter instead, then things work again.

I suspect some recent changes to how the URL matching code works may have broken this for me.

vscode-chrome-debug.txt

urlFilter is actually the correct thing to use here. Use url when the browser needs to be explicitly navigated to the url. That's not the case when working with electron. It would have worked anyway before the last couple releases, now we launch to about:blank then navigate to the real url (so we can set up breakpoints before loading the page) but that won't work with electron.