vscode: [node-debugger] Debugger spams "Could not read sourcemaps" messages

  • VSCode Version: 1.47.0-insider (system setup)
  • OS Version: Windows_NT x64 10.0.19041

Steps to Reproduce:

  1. Add a dependency which has .js-files containing //# sourceMappingURL=[...]
  2. Make sure the dependencies do not contain source-maps
  3. Run the node-debugger

Does this issue occur when all extensions are disabled? Yes

Expected behavior Just like in the previous version of VSCode, missing source-map files should not be reported (should they…?).

Actual behavior VSCode reports an error for every missing source-map files (even the ones inside the node_modules folder). This makes reviewing mocha debug sessions quite hard.

Screenshot

image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for the issue, this message was added in https://github.com/microsoft/vscode-js-debug/issues/483, and matches what happens in the web browser if Chrome fails to resolve sourcemaps. (However, in Chrome you can toggle these messages, where our debug console has no such control.)

You can configure whether we resolve sourcemaps by specifying the new resolveSourceMapLocations option, e.g. this will disable resolution in node_modules:

"resolveSourceMapLocations": [
  "${workspaceFolder}/**",
  "!**/node_modules/**"
],

👍 this comment/issue if you’d like a setting to toggle off these messages.

“resolveSourceMapLocations”: [ “${workspaceFolder}/", "!/node_modules/**” ],

Where should I put the configuration?

Into your launch.json file as seen here: https://github.com/manuth/NPMPackageEditor/blob/1564214c0d4a5dbf9b377218eb54edeaddf2fb3c/.vscode/launch.json#L15-L18

Keep in mind to change the type-property to pwa-node as mentioned by @connor4312

in launch.json,

"type": "pwa-node",
"resolveSourceMapLocations": [
    "${workspaceFolder}/**",
    "!**/node_modules/**"
]

AND restart vscode, and it’s solved.

@manuth Thanks, buddy! Works like a charm.

You may be hitting #102152. If not, please capture a trace log using the instructions I sent you.

thanks a lot, set debug.javascript.usePreview: false is worked for me.

Something there is. If the locations list is left at null, we’ll resolve all sourcemaps without checking paths. With it specified, we require the sourcemap to match one of the patterns.

But one alternative closer to parity is to set it to **, omitting workspaceFolder, which will match all paths (unless they’re later excluded). Updated the default in js-debug to that.

We’ve had quite a few people opening issues about this.

The root problem is not the spam, but errors about files you don’t care about. If a source map failed for a file you did expect to debug, it would not be desirable to hide that information. I think it’s reasonable to just disable sourcemaps within node_modules by default; if users need them, they can configure the resolveSourceMapLocations to remove that exclusion.

Currently, the old debuggers are “forwarding” the request to the new debugger (https://github.com/microsoft/vscode-js-debug/issues/548). They don’t know about the new options, but will pass them through. You can change the debug type to pwa-node to go directly to the new debugger.

@connor4312 I, btw, just gave it a go before - your recommended configuration works like a charm! Though, it looks like the json-schema isn’t up to date yet, as I receive a Property resolveSourceMapLocations is not allowed. when adding this to my configuration.

Instead of having an option to disable source-map messages I’d prefer to have these messages disabled for node_modules by default.

It’s good here. I’ll direct people to it as needed 🙂