Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Debugger Unable to Map Breakpoints When Using Proxied Domains #2203

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

Open
BobbyJonas opened this issue Apr 12, 2025 · 1 comment
Open

Debugger Unable to Map Breakpoints When Using Proxied Domains #2203

BobbyJonas opened this issue Apr 12, 2025 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@BobbyJonas
Copy link

BobbyJonas commented Apr 12, 2025

Describe the bug

I'm experiencing an issue with VSCode's debugging capabilities when using a proxied domain that points to a local development server. While the page loads correctly through the proxy, VSCode is unable to map breakpoints to the source files.

To Reproduce

I have a local development server running on localhost:3000 and I've set up a proxy to map an external domain (https://www.mydomain.com) to this local server. The source files and sourcemaps are all generated and available locally at paths like: /Users/personal/Desktop/rsbuild-vue2-test/src/App.vue

My launch.json configuration:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Debug Page",
      "presentation": {
        "group": "creation"
      },
      "url": "https://www.mydomain.com",
      "suppressMultipleSessionWarning": false,
      "webRoot": "${workspaceFolder}",
      "sourceMaps": true,
      "disableNetworkCache": true,
      "pathMapping": {
        "/": "${webRoot}/"
      },
      "sourceMapPathOverrides": {
        "${webRoot}/src/*": "${webRoot}/src/*",
        "${webRoot}/*": "${webRoot}/*",
        "*": "${webRoot}/*"
      },
      "outFiles": [
        "${workspaceFolder}/**/*.(m|c|)js",
        "!**/node_modules/**"
      ],
      "runtimeArgs": [
        "--proxy-server=http://127.0.0.1:8899",
        "--disable-web-security",
        "--allow-insecure-localhost"
      ],
      "skipFiles": ["**/node_modules/**"]
    }
  ]
}

The problem is when I access my web app through the proxied domain, the debugger is unable to map breakpoints to the source files. The page loads correctly, but breakpoints set in VSCode are never hit.

The sourcemaps are correctly generated with local file paths:

"sources": ["/Users/personal/Desktop/rsbuild-vue2-test/src/App.vue?vue&type=style&index=0&id=7ba5bd90&scoped=true&lang=css"]

However, when accessing through the proxied domain (https://www.mydomain.com, which is actually my local page), VSCode seems unable to resolve these local file paths in the sourcemaps. Meanwhile if the browser accesses the local domain name without proxy, sourcemap and breakpoints work normally.

Expected Behavior

VSCode should be able to map breakpoints correctly even when the application is accessed through a proxied domain, as long as the sourcemaps correctly reference the local file system paths.

Actual Behavior

Breakpoints are never hit when debugging through the proxied domain. The same setup works correctly when accessing directly through localhost:3000.

  • The breakpoint diagnosis of the local service is like this:
Image

It seems that the resources are loaded normally, and the debugger works normally as well.

  • The breakpoint diagnosis of the proxied remote domain is like this:
Image Image

Only the entry file of the main resource is loaded, but it seems that the sources array of the sourcemap is not processed

Log File

vscode-debugadapter-83148277.json

VS Code Version

Version: 1.99.2 (Universal)
Commit: 4949701c880d4bdb949e3c0e6b400288da7f474b
Date: 2025-04-10T01:21:25.295Z (2 days ago)
Electron: 34.3.2
ElectronBuildId: 11161073
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Darwin arm64 23.6.0

@BobbyJonas BobbyJonas added the bug Issue identified by VS Code Team member as probable bug label Apr 12, 2025
@BobbyJonas
Copy link
Author

BobbyJonas commented Apr 12, 2025

After looking at the trace log, I found that it was a proxy problem:

I did not turned on the proxy in the global mode, and my web app was proxied by a Chrome plugin or arguments, which is configured in the launch args in launch.json.
However, it was not in the VSCode that the sourcemap acquisition process run (quite confused about that). VSCode could not get the sourcemap and this error occurred.

But is there a plan to make this process more unified? Either configure it only once, or maybe configure it uniformly in this json?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants