microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 282 forks source link

No longer able to attach to chrome 68 and below #788

Closed clagar closed 4 years ago

clagar commented 4 years ago

Describe the bug After upgrading to VS Code 1.47.0, I am no longer able to attach to chrome 68 and below. Issue is reproducible in VS Code 1.49.3 with ms-vscode.js-debug-nightly. Debugging works when setting debug.javascript.usePreview to false. Debugging works with chrome 69 and up.

To Reproduce Steps to reproduce the behavior:

  1. Launch chrome 68 with remote debugging: chrome.exe --remote-debugging-port=9222
  2. Open a web page
  3. In VS Code, start debugging.
  4. Attaching looks to work but debug console is empty and breakpoints remain unbound.
  5. Log file contains: 'Target.attachToBrowserTarget' wasn't found

Log File

{"timestamp":1602010392390,"tag":"runtime.welcome","level":1,"message":"js-debug-nightly v2020.9.2817 started","metadata":{"os":"win32 x64","nodeVersion":"v12.14.1","adapterVersion":"2020.9.2817"}}
{"tag":"dap.receive","timestamp":1602010392377,"metadata":{"connectionId":20,"message":{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"pwa-chrome","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}},"level":0}
{"tag":"dap.send","timestamp":1602010392377,"metadata":{"connectionId":20,"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"caught","label":"Caught Exceptions","default":false},{"filter":"uncaught","label":"Uncaught Exceptions","default":false}],"supportsStepBack":false,"supportsSetVariable":true,"supportsRestartFrame":true,"supportsGotoTargetsRequest":false,"supportsStepInTargetsRequest":false,"supportsCompletionsRequest":true,"supportsModulesRequest":false,"additionalModuleColumns":[],"supportedChecksumAlgorithms":[],"supportsRestartRequest":true,"supportsExceptionOptions":false,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":true,"supportsLoadedSourcesRequest":true,"supportsLogPoints":true,"supportsTerminateThreadsRequest":false,"supportsSetExpression":false,"supportsTerminateRequest":false,"completionTriggerCharacters":[".","[","\"","'"],"supportsBreakpointLocationsRequest":true,"supportsClipboardContext":true}}},"level":0}
{"tag":"dap.send","timestamp":1602010392377,"metadata":{"connectionId":20,"message":{"seq":2,"type":"event","event":"initialized","body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1602010392384,"metadata":{"connectionId":20,"message":{"command":"attach","arguments":{"name":"Attach to Chrome","type":"pwa-chrome","request":"attach","url":"http://localhost:5555/","port":9222,"webRoot":"C:\\dev\\test","sourceMaps":true,"trace":"verbose","__workspaceFolder":"c:\\dev\\test","__sessionId":"58c689da-8722-4867-aca0-b911222be2c6"},"type":"request","seq":2}},"level":0}
{"tag":"dap.send","timestamp":1602010392384,"metadata":{"connectionId":20,"message":{"seq":3,"type":"event","event":"output","body":{"category":"console","output":"Note: Using the \"preview\" debug extension\n"}}},"level":0}
{"tag":"dap.send","timestamp":1602010392385,"metadata":{"connectionId":20,"message":{"seq":4,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/launch","data":{"type":"pwa-chrome","request":"attach","os":"win32 x64","nodeVersion":"v12.14.1","adapterVersion":"2020.9.2817","parameters":"{\"type\":\"pwa-chrome\",\"name\":\"<string>\",\"request\":\"attach\",\"trace\":\"<string>\",\"outputCapture\":\"console\",\"timeout\":10000,\"timeouts\":{},\"showAsyncStacks\":true,\"skipFiles\":[],\"smartStep\":true,\"sourceMaps\":true,\"pauseForSourceMap\":true,\"resolveSourceMapLocations\":null,\"rootPath\":\"<string>\",\"outFiles\":[\"<string>\",\"<string>\"],\"sourceMapPathOverrides\":{\"webpack:///./~/*\":\"<string>\",\"webpack:////*\":\"<string>\",\"webpack://?:*/*\":\"<string>\",\"webpack:///([a-z]):/(.+)\":\"<string>\",\"meteor://💻app/*\":\"<string>\"},\"enableContentValidation\":true,\"cascadeTerminateToConfigurations\":[],\"__workspaceFolder\":\"<string>\",\"__autoExpandGetters\":false,\"__breakOnConditionalError\":false,\"address\":\"localhost\",\"port\":9222,\"disableNetworkCache\":true,\"pathMapping\":{},\"url\":\"<string>\",\"restart\":false,\"urlFilter\":\"*\",\"webRoot\":\"<string>\",\"server\":null,\"browserAttachLocation\":\"workspace\",\"targetSelection\":\"automatic\",\"vueComponentPaths\":[\"<string>\",\"<string>\"],\"__sessionId\":\"<string>\"}"}}}},"level":0}
{"tag":"dap.send","timestamp":1602010392387,"metadata":{"connectionId":20,"message":{"seq":5,"type":"event","event":"output","body":{"category":"console","output":"Verbose logs are written to:\nC:\\Users\\Test\\AppData\\Local\\Temp\\vscode-debugadapter-0.json.gz\n"}}},"level":0}
{"tag":"dap.receive","timestamp":1602010392394,"metadata":{"connectionId":20,"message":{"command":"setBreakpoints","arguments":{"source":{"name":"test.js","path":"c:\\dev\\test\\test.js"},"lines":[27],"breakpoints":[{"line":27}],"sourceModified":false},"type":"request","seq":3}},"level":0}
{"tag":"dap.send","timestamp":1602010392394,"metadata":{"connectionId":20,"message":{"seq":6,"type":"response","request_seq":3,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"id":1,"verified":false,"message":"Unbound breakpoint"}]}}},"level":0}
{"tag":"runtime.launch","timestamp":1602010392395,"message":"Discovered target URL from /json/version","metadata":{"url":"ws://localhost/devtools/browser/1c9d2984-b1bc-45fe-ad53-7cf93def5253","fixed":"ws://localhost:9222/devtools/browser/1c9d2984-b1bc-45fe-ad53-7cf93def5253"},"level":0}
{"tag":"cdp.send","timestamp":1602010392397,"metadata":{"connectionId":14,"message":{"id":1001,"method":"Target.attachToBrowserTarget","params":{}}},"level":0}
{"tag":"cdp.receive","timestamp":1602010392397,"metadata":{"connectionId":14,"message":{"error":{"code":-32601,"message":"'Target.attachToBrowserTarget' wasn't found"},"id":1001}},"level":0}
{"tag":"runtime.launch","timestamp":1602010392398,"message":"Launched successfully","metadata":{"name":"b"},"level":1}
{"tag":"dap.send","timestamp":1602010392398,"metadata":{"connectionId":20,"message":{"seq":7,"type":"response","request_seq":2,"command":"attach","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1602010392434,"metadata":{"connectionId":20,"message":{"command":"setExceptionBreakpoints","arguments":{"filters":[]},"type":"request","seq":4}},"level":0}
{"tag":"dap.send","timestamp":1602010392434,"metadata":{"connectionId":20,"message":{"seq":8,"type":"response","request_seq":4,"command":"setExceptionBreakpoints","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1602010392441,"metadata":{"connectionId":20,"message":{"command":"loadedSources","type":"request","seq":5}},"level":0}
{"tag":"dap.send","timestamp":1602010392441,"metadata":{"connectionId":20,"message":{"seq":9,"type":"response","request_seq":5,"command":"loadedSources","success":true,"body":{"sources":[]}}},"level":0}
{"tag":"dap.receive","timestamp":1602010392444,"metadata":{"connectionId":20,"message":{"command":"configurationDone","type":"request","seq":6}},"level":0}
{"tag":"dap.send","timestamp":1602010392444,"metadata":{"connectionId":20,"message":{"seq":10,"type":"response","request_seq":6,"command":"configurationDone","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1602010392450,"metadata":{"connectionId":20,"message":{"command":"threads","type":"request","seq":7}},"level":0}
{"tag":"dap.send","timestamp":1602010392450,"metadata":{"connectionId":20,"message":{"seq":11,"type":"response","request_seq":7,"command":"threads","success":true,"body":{"threads":[]}}},"level":0}
{"tag":"dap.send","timestamp":1602010397378,"metadata":{"connectionId":20,"message":{"seq":12,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"initialize":{"operation":"initialize","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!initialize.errors":[],"setBreakpoints":{"operation":"setBreakpoints","totalTime":0.1,"max":0.1,"avg":0.1,"stddev":null,"count":1,"failed":0},"!setBreakpoints.errors":[],"attach":{"operation":"attach","totalTime":13.5,"max":13.5,"avg":13.5,"stddev":null,"count":1,"failed":0},"!attach.errors":[],"setExceptionBreakpoints":{"operation":"setExceptionBreakpoints","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!setExceptionBreakpoints.errors":[],"loadedSources":{"operation":"loadedSources","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!loadedSources.errors":[],"configurationDone":{"operation":"configurationDone","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!configurationDone.errors":[],"threads":{"operation":"threads","totalTime":0.1,"max":0.1,"avg":0.1,"stddev":null,"count":1,"failed":0},"!threads.errors":[]}}}},"level":0}
{"tag":"dap.receive","timestamp":1602010405304,"metadata":{"connectionId":20,"message":{"command":"breakpointLocations","arguments":{"source":{"name":"test.js","path":"c:\\dev\\test\\test.js"},"line":27},"type":"request","seq":8}},"level":0}
{"tag":"dap.send","timestamp":1602010405304,"metadata":{"connectionId":20,"message":{"seq":13,"type":"response","request_seq":8,"command":"breakpointLocations","success":true,"body":{"breakpoints":[]}}},"level":0}
{"tag":"dap.send","timestamp":1602010410304,"metadata":{"connectionId":20,"message":{"seq":14,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"breakpointLocations":{"operation":"breakpointLocations","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!breakpointLocations.errors":[]}}}},"level":0}
{"tag":"dap.receive","timestamp":1602010414877,"metadata":{"connectionId":20,"message":{"command":"disconnect","arguments":{"restart":false},"type":"request","seq":9}},"level":0}
{"tag":"dap.send","timestamp":1602010414877,"metadata":{"connectionId":20,"message":{"seq":15,"type":"response","request_seq":9,"command":"disconnect","success":true,"body":{}}},"level":0}
{"tag":"dap.send","timestamp":1602010414878,"metadata":{"connectionId":20,"message":{"seq":16,"type":"event","event":"terminated","body":{}}},"level":0}

VS Code Version: 1.49.3

Additional context launch.json

{
    "name": "Attach to Chrome",
    "type": "chrome",
    "request": "attach",
    "url": "http://localhost:5555/",
    "port": 9222,
    "webRoot": "${workspaceFolder}",
    "sourceMaps": true,
    "trace": "verbose"
}

Chromium 68 can be found here: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win/561739/

connor4312 commented 4 years ago

We do not support Chrome versions that old, sorry.

I recommend using a newer version of Chrome, as Chrome 68 will be behind several years worth of security updates.