Skip to content
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

"Could not read source map ..." #169733

Closed
maziac opened this issue Dec 21, 2022 · 10 comments · Fixed by microsoft/vscode-js-debug#1578
Closed

"Could not read source map ..." #169733

maziac opened this issue Dec 21, 2022 · 10 comments · Fixed by microsoft/vscode-js-debug#1578
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@maziac
Copy link

maziac commented Dec 21, 2022

Version: 1.74.2
Commit: e8a3071
Date: 2022-12-20T10:26:09.430Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 21.6.0
Sandboxed: No

When I try to debug any extension I get the following errors in the Debug Console:

Could not read source map for file:///Volumes/SDDPCIE2TB/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/out-vscode/vs/loader.js: ENOENT: no such file or directory, open '/Volumes/SDDPCIE2TB/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/out-vscode/vs/nls.js.map'
Could not read source map for file:///Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/%40azure/core-http/dist-esm/src/httpHeaders.js: ENOENT: no such file or directory, open '/Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/@azure/core-http/dist-esm/src/httpHeaders.js.map'
Could not read source map for file:///Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/%40azure/core-http/dist-esm/src/util/base64.js: ENOENT: no such file or directory, open '/Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/@azure/core-http/dist-esm/src/util/base64.js.map'
Could not read source map for file:///Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/%40azure/core-http/dist-esm/src/util/serializer.common.js: ENOENT: no such file or directory, open '/Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/@azure/core-http/dist-esm/src/util/serializer.common.js.map'
Could not read source map for file:///Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/%40azure/core-http/dist-esm/src/util/utils.js: ENOENT: no such file or directory, open '/Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/@azure/core-http/dist-esm/src/util/utils.js.map'
Could not read source map for file:///Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/%40azure/core-http/dist-esm/src/serializer.js: ENOENT: no such file or directory, open '/Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/@azure/core-http/dist-esm/src/serializer.js.map'
Could not read source map for file:///Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/%40azure/core-http/dist-esm/src/webResource.js: ENOENT: no such file or directory, open '/Volumes/SDDPCIE2TB/Projects/vscode/DeZog/node_modules/@azure/core-http/dist-esm/src/webResource.js.map'
...
...

I think this started with vscode 1.74 but I'm not sure.

I also tried to change the launch.json to use "resolveSourceMapLocations"

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "extensionHost",
			"request": "launch",
			"name": "Extension",
			"preLaunchTask": "npm",
			"runtimeExecutable": "${execPath}",
			"args": [
				"--extensionDevelopmentPath=${workspaceFolder}"
			],
			"outFiles": [ "${workspaceFolder}/out/**/*.js" ],
			"smartStep": true,
			"skipFiles": [
				//"inspector_async_hook.js",
				//"async_hooks.js",
				"**/extensionHostProcess.js"
			],
			"resolveSourceMapLocations": [
				"${workspaceFolder}/**",
				"!**/node_modules/**"
			]
		}
	]
}

But that does not help either.
I can't change the type to pwa-node as suggested somewhere, because then I cannot debug the extension anymore.

@vemoo
Copy link
Contributor

vemoo commented Dec 21, 2022

I'm also seen a lot of Could not read source map for ... errors in the debug console.

The weird thing is the errors reference paths on node_modules but my extension is only importing vscode and node:* modules.

It seems I'm seeing errors related to some internal vscode code, because they appear even if I add --disable-extensions to launch.json args.

@vemoo
Copy link
Contributor

vemoo commented Dec 21, 2022

On 1.74.0 I only get:

Could not read source map for file:///home/berni/zProgs/VSCode-linux-x64_1.74.0/resources/app/out/vs/out-vscode/vs/loader.js: ENOENT: no such file or directory, open '/home/berni/zProgs/VSCode-linux-x64_1.74.0/resources/app/out/vs/out-vscode/vs/nls.js.map'

But on 1.74.1 I get:

Could not read source map for file:///home/berni/zProgs/VSCode-linux-x64_1.74.1/resources/app/out/vs/out-vscode/vs/loader.js: ENOENT: no such file or directory, open '/home/berni/zProgs/VSCode-linux-x64_1.74.1/resources/app/out/vs/out-vscode/vs/nls.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/httpHeaders.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/httpHeaders.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/util/base64.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/util/base64.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/util/serializer.common.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/util/serializer.common.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/util/utils.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/util/utils.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/serializer.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/serializer.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/webResource.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/webResource.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/abort-controller/dist-esm/src/AbortSignal.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/abort-controller/dist-esm/src/AbortSignal.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/abort-controller/dist-esm/src/AbortController.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/abort-controller/dist-esm/src/AbortController.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/url.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/url.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/proxyAgent.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/proxyAgent.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/util/sanitizer.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/util/sanitizer.js.map'
Could not read source map for file:///home/berni/Documents/src/work-vscode-extension/node_modules/%40azure/core-http/dist-esm/src/util/inspect.js: ENOENT: no such file or directory, open '/home/berni/Documents/src/work-vscode-extension/node_modules/@azure/core-http/dist-esm/src/util/inspect.js.map'
...

There are 385 lines in total

@roblourens roblourens assigned connor4312 and unassigned roblourens Dec 23, 2022
@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Dec 26, 2022
@jaybo
Copy link

jaybo commented Jan 18, 2023

I don't know if this is the same bug or not, but I'm using Quasar/Vue building a PWA and for the last few months I've started getting getting hundreds of messages for node_modules source map errors like:

Could not read source map for file:///D:/devGit/dzweb/ClientApp/src/webpack%3A/dzweb/node_modules/%40tiptap/extension-paragraph/dist/tiptap-extension-paragraph.esm.js: ENOENT: no such file or directory, open 'd:\devGit\dzweb\ClientApp\src\webpack:\dzweb\node_modules\@tiptap\extension-paragraph\dist\tiptap-extension-paragraph.esm.js.map'

If I try using resolveSourceMapLocations, then breakpoints stop resolving.

 {
    "type": "chrome",
    "request": "launch",
    "name": "dzweb Launch Chrome",
    "url": "https://localhost:44346",
    "webRoot": "${workspaceFolder}/src",
    "sourceMaps": true,
    "sourceMapPathOverrides": {
        "webpack://dzweb/./src/*": "${webRoot}/*"
    },
    // "resolveSourceMapLocations":
    // [
    //     "${workspaceFolder}/**",
    //     "!**/node_modules/**"
    // ],
    "trace": true
},

Attached is a trace:true logfile.
vscode-debugadapter-7f528afa.json.gz

@connor4312
Copy link
Member

connor4312 commented Feb 1, 2023

@jaybo in your case, that was a result of microsoft/vscode-js-debug#1410, since the debugger will now look for recursively included sourcemaps. And, as a result of your sourceMapPathOverrides paths like

webpack://dzweb/./node_modules/@tiptap/extension-paragraph/dist/tiptap-extension-paragraph.esm.js

gets resolved to

d:\\devGit\\dzweb\\ClientApp\\src\\webpack:\\dzweb\\node_modules\\@tiptap\\extension-paragraph\\dist\\tiptap-extension-paragraph.esm.js

which are inside the included sourcemap resolution locations, but obviously not valid. You should be able to just remove the sourceMapPathOverrides and webRoot from your launch.json and have the defaults work 🙂

 {
    "type": "chrome",
    "request": "launch",
    "name": "dzweb Launch Chrome",
    "url": "https://localhost:44346"
},

I would need trace logs from others to see what's going on there.

/jsDebugLogs

@vscodenpa
Copy link

Please collect trace logs using the following instructions:

If you're able to, add "trace": true to your launch.json and reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.

⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to connor@xbox.com

@vscodenpa vscodenpa added the info-needed Issue requires more information from poster label Feb 1, 2023
@jaybo
Copy link

jaybo commented Feb 2, 2023

@connor4312 Removing webroot, sourceMaps, sourceMapPathOverrides, resolveSourceMapLocations works! No more missing map files. THANK YOU!

@alexv-globalvision
Copy link

alexv-globalvision commented Feb 24, 2023

I am also encountering the same issue, it seems to be loading sourcemaps for things that are neither deps of my project, nor paths I can find in the VScode.app in my /Applications directory.

vscode-debugadapter-8a044e9e.json.gz

launch.json

{
    "version": "0.2.0",
    "trace": true,
    "configurations": [
        {
            "name": "Extension",
            "trace": true,
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}"
            ],
        }
    ]
}

Here is a small sample of the debug console output when i launch the extension using F5

Could not read source map for file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/out-vscode/vs/loader.js: ENOENT: no such file or directory, open '/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/out-vscode/vs/nls.js.map'
Could not read source map for file:///Users/avados/things/scvsc/node_modules/universal-user-agent/dist-web/index.js: ENOENT: no such file or directory, open '/Users/avados/things/scvsc/node_modules/universal-user-agent/dist-web/index.js.map'
Could not read source map for file:///Users/avados/things/scvsc/node_modules/%40octokit/endpoint/dist-web/index.js: ENOENT: no such file or directory, open '/Users/avados/things/scvsc/node_modules/@octokit/endpoint/dist-web/index.js.map'
Could not read source map for file:///Users/avados/things/scvsc/node_modules/%40octokit/request-error/dist-web/index.js: ENOENT: no such file or directory, open '/Users/avados/things/scvsc/node_modules/@octokit/request-error/dist-web/index.js.map'
Could not read source map for file:///Users/avados/things/scvsc/node_modules/%40octokit/request/dist-web/index.js: ENOENT: no such file or directory, open '/Users/avados/things/scvsc/node_modules/@octokit/request/dist-web/index.js.map'
Could not read source map for file:///Users/avados/things/scvsc/node_modules/%40octokit/graphql/dist-web/index.js: ENOENT: no such file or directory, open '/Users/avados/things/scvsc/node_modules/@octokit/graphql/dist-web/index.js.map'
Could not read source map for file:///Users/avados/things/scvsc/node_modules/%40octokit/auth-token/dist-web/index.js: ENOENT: no such file or directory, open '/Users/avados/things/scvsc/node_modules/@octokit/auth-token/dist-web/index.js.map'

Version: 1.75.1 (Universal)
Commit: 441438a

node version 16.18.1

@connor4312
Copy link
Member

Oh, I see what's happening, thanks. We weren't re-checking resolveSourceMapLocations for resolving recursive sourcemaps, resulting in this problem being hit if an extension was built and debugged using a bundler like webpack.

connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Feb 27, 2023
@connor4312 connor4312 removed the info-needed Issue requires more information from poster label Feb 27, 2023
@connor4312 connor4312 added this to the March 2023 milestone Feb 27, 2023
@connor4312
Copy link
Member

connor4312 commented Feb 27, 2023

The fix will be in the next nightly build, please try it out and let me know if the fix works for you.

connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Feb 28, 2023
* fix: recursive source map resolution parsing ignored locations

Fixes microsoft/vscode#169733

* fix long-standing test flake
@amunger amunger added the verified Verification succeeded label Mar 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants