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

VS code crashes when debugging after update with Node <=12 #1624

Closed
iii-james opened this issue Mar 30, 2023 · 13 comments · Fixed by #1627 or #1638
Closed

VS code crashes when debugging after update with Node <=12 #1624

iii-james opened this issue Mar 30, 2023 · 13 comments · Fixed by #1627 or #1638
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release verified Verification succeeded

Comments

@iii-james
Copy link

iii-james commented Mar 30, 2023

Describe the bug
After VS code updated to 1.77.0 I can no longer debug my NodeJS application.

To Reproduce
Click the debug button

Launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceRoot}/server/src/index.ts",
            "sourceMaps": true,
            "outFiles": [
                "${workspaceRoot}/server/dist/**/*.js"  
            ]
        }
    ]
}

Debug Console

        c:\Users\James.Morris\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\bootloader.js:8
        `+r)),e.removeListener("error",er),e.destroy()}});var Rs=V((Vu,Cs)=>{"use strict";var xa=Object.create,pt=Object.defineProperty,ba=Object.getOwnPropertyDescriptor,Ss=Object.getOwnPropertyNames,va=Object.getPrototypeOf,Sa=Object.prototype.hasOwnProperty,Ea=(e,t)=>function(){return t||(0,e[Ss(e)[0]])((t={exports:{}}).exports,t),t.exports},Ta=(e,t)=>{for(var r in t)pt(e,r,{get:t[r],enumerable:!0})},Es=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ss(t))!Sa.call(e,s)&&s!==r&&pt(e,s,{get:()=>t[s],enumerable:!(n=ba(t,s))||n.enumerable});return e},Ca=(e,t,r)=>(r=e!=null?xa(va(e)):{},Es(t||!e||!e.__esModule?pt(r,"default",{value:e,enumerable:!0}):r,e)),Ra=e=>Es(pt({},"__esModule",{value:!0}),e),Aa=Ea({"node_modules/request-light/lib/node/main.js"(e){(()=>{var t={46:(i,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=function(l,f,{signal:
        
        SyntaxError: Unexpected token .
            at Module._compile (internal/modules/cjs/loader.js:723:23)
            at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
            at Module.load (internal/modules/cjs/loader.js:653:32)
            at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
            at Function.Module._load (internal/modules/cjs/loader.js:585:3)
            at Module.require (internal/modules/cjs/loader.js:692:17)
            at require (internal/modules/cjs/helpers.js:25:18)
            at Object.<anonymous> (C:\Users\JAMES~1.MOR\AppData\Local\Temp\vscode-js-debug-bootloader.js:1:1)
            at Module._compile (internal/modules/cjs/loader.js:778:30)
            at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
        Process exited with code 1

Log File
vscode-debugadapter-c0d5382f.json.gz

VS Code Version:
Version: 1.77.0 (user setup)
Commit: 7f329fe6c66b0f86ae1574c2911b681ad5a45d63
Date: 2023-03-29T10:02:16.981Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.19044
Sandboxed: No

Additional context

@iii-james iii-james added the bug Issue identified by VS Code Team member as probable bug label Mar 30, 2023
@connor4312
Copy link
Member

Can you grab a recording/gif of your vscode window? https://gifcap.dev/ is helpful

@iii-james
Copy link
Author

Recording 2023-03-30 at 15 50 16

@connor4312
Copy link
Member

Thanks, looks like that's an issue on very old Node.js versions. I will put in a patch for this, but I also strongly recommend upgrading as your version of Node.js has been end of life for about two years now and no longer receives security updates.

@iii-james
Copy link
Author

@connor4312 Thanks for looking into this. I plan on updating NodeJS later. I have some dependency issues to work out first. Is there a way I can track the progress of the patch?

@connor4312
Copy link
Member

I'll put a fix in for this today. When the issue is closed, it'll be fixed in sources. You can expect it to appear in the nightly build shortly after 5PM PST the same day.

connor4312 added a commit to microsoft/vscode-l10n that referenced this issue Mar 31, 2023
Refs microsoft/vscode-js-debug#1624

I noticed that issue was being called by new syntax being used in the
bootloader that Node 12 didn't understand. But localizations shouldn't
be in the bootloader at all, and with this change, it enables
@vscode/l10n to be tree shaken out.

Separate issue is why our test suites that nominally run Node 8 didn't
pick up on this earlier...
TylerLeonhardt pushed a commit to microsoft/vscode-l10n that referenced this issue Mar 31, 2023
* fix: mark @vscode/l10n as side-effect-free

Refs microsoft/vscode-js-debug#1624

I noticed that issue was being called by new syntax being used in the
bootloader that Node 12 didn't understand. But localizations shouldn't
be in the bootloader at all, and with this change, it enables
@vscode/l10n to be tree shaken out.

Separate issue is why our test suites that nominally run Node 8 didn't
pick up on this earlier...

* rev to 0.0.13
@connor4312 connor4312 added this to the April 2023 milestone Mar 31, 2023
connor4312 added a commit that referenced this issue Mar 31, 2023
Fixes #1624

Updates @vscode/l10n to allow it to be tree-shaken away.

Also moves `checkContentHash` that likewise had a dependency on more
modern language features. I think webpack was just extra aggressive
about tree shaking before and assumed `new Hasher()` was side effect
free. Which is was, it's just a big assumption to have made.

And when I had updated versions in our pipelines, I accidentally updated
the minspec to no longer target Node 8 🤦‍♂️. Targeting the latest 10 should
be good. Node 8 thankfully <0.25% of users nowadays.
connor4312 added a commit that referenced this issue Mar 31, 2023
Fixes #1624

Updates @vscode/l10n to allow it to be tree-shaken away.

Also moves `checkContentHash` that likewise had a dependency on more
modern language features. I think webpack was just extra aggressive
about tree shaking before and assumed `new Hasher()` was side effect
free. Which is was, it's just a big assumption to have made.

And when I had updated versions in our pipelines, I accidentally updated
the minspec to no longer target Node 8 🤦‍♂️. Targeting the latest 10 should
be good. Node 8 thankfully <0.25% of users nowadays.
connor4312 added a commit that referenced this issue Mar 31, 2023
* fix: sourcemap lookups on ipv6 localhost addresses

TIL that assigning an invalid value to `url.hostname` silently fails
if invalid.

Fixes microsoft/vscode#167353

* fix: debugger failing on Node <=12

Fixes #1624

Updates @vscode/l10n to allow it to be tree-shaken away.

Also moves `checkContentHash` that likewise had a dependency on more
modern language features. I think webpack was just extra aggressive
about tree shaking before and assumed `new Hasher()` was side effect
free. Which is was, it's just a big assumption to have made.

And when I had updated versions in our pipelines, I accidentally updated
the minspec to no longer target Node 8 🤦‍♂️. Targeting the latest 10 should
be good. Node 8 thankfully <0.25% of users nowadays.

* keep broken minspec for the moment
@connor4312 connor4312 added the candidate Issue identified as probable candidate for fixing in the next release label Mar 31, 2023
connor4312 added a commit that referenced this issue Mar 31, 2023
* fix: sourcemap lookups on ipv6 localhost addresses

TIL that assigning an invalid value to `url.hostname` silently fails
if invalid.

Fixes microsoft/vscode#167353

* fix: debugger failing on Node <=12

Fixes #1624

Updates @vscode/l10n to allow it to be tree-shaken away.

Also moves `checkContentHash` that likewise had a dependency on more
modern language features. I think webpack was just extra aggressive
about tree shaking before and assumed `new Hasher()` was side effect
free. Which is was, it's just a big assumption to have made.

And when I had updated versions in our pipelines, I accidentally updated
the minspec to no longer target Node 8 🤦‍♂️. Targeting the latest 10 should
be good. Node 8 thankfully <0.25% of users nowadays.

* keep broken minspec for the moment
@connor4312
Copy link
Member

connor4312 commented Mar 31, 2023

This is now fixed in the nightly build. I will also propose it for a recovery release next week.

@connor4312 connor4312 changed the title VS code crashes when debugging after update VS code crashes when debugging after update with Node <=12 Mar 31, 2023
@qdevico
Copy link

qdevico commented Apr 3, 2023

Still not working, but now without crashing and errors

@duzenko
Copy link

duzenko commented Apr 3, 2023

It just freezes
@connor4312 could you please actually test your 'fixes'?

console.log(process.version)
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program qwe",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "runtimeVersion": "11.15.0",
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}/scripts/test.js"
        }
    ]
}

image

@connor4312
Copy link
Member

Thanks for letting me know, it looks like esbuild by default can change syntax during its minification process, which I didn't catch when developing the (unminified) extension locally. New build incoming in a little while.

@starball5
Copy link

starball5 commented Apr 3, 2023

@rafaelpalladino
Copy link

@connor4312 how do I get the fix? I need to wait for a future VS Code release next week?

@connor4312
Copy link
Member

connor4312 commented Apr 3, 2023

I just published the new nightly build with that fix, version v2023.4.312. It'll take 5-10 minutes to propagate to the CDN.

If you don't see this, run "Check for extension updates", and a reload button should appear on the nightly extension list item
image

@rebornix rebornix added the verified Verification succeeded label Apr 4, 2023
@rebornix
Copy link
Member

rebornix commented Apr 4, 2023

Verified and it started the debugger successfully

Note: Using the "preview" debug extension
/Users/penlv/.nvm/versions/node/v10.24.1/bin/node ./test.js

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 candidate Issue identified as probable candidate for fixing in the next release verified Verification succeeded
Projects
None yet
7 participants