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

TpeError: Cannot read properties of undefined (reading 'toString') #1502

Closed
phortonssf opened this issue Dec 31, 2022 · 9 comments · Fixed by #1533
Closed

TpeError: Cannot read properties of undefined (reading 'toString') #1502

phortonssf opened this issue Dec 31, 2022 · 9 comments · Fixed by #1533
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@phortonssf
Copy link

Describe the bug
When starting the debugger node vsDebugServer.js
I get the following error.

[dap-js] JS Debugger stderr:
[dap-js] JS Debugger stderr: ~/.local/share/nvim/site/pack/packer/opt/vscode-js-debug/src/vsDebugServer.ts:93
    console.log((result.server.address() as net.AddressInfo).port.toString());
                                                                 ^
TypeError: Cannot read properties of undefined (reading 'toString')
    at VsDebugServer.launchRoot (~/.local/share/nvim/site/pack/packer/opt/vscode-js-debug/src/vsDebugServer.ts:93:66)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

[dap-js] JS Debugger exited with code 1!

To Reproduce

  1. Installed latest and uzzipped the lates build, 1.74.1
  2. ran npm install and npm run compile
  3. tsc --version
    Version 4.9.3

node -v
v18.12.1

@phortonssf phortonssf added the bug Issue identified by VS Code Team member as probable bug label Dec 31, 2022
@phortonssf
Copy link
Author

I tried vscode-js-debug-1.72.0 and it worked fine, note i didn't try anything between 1.72.0 and latest 1.74.1.

@revmischa
Copy link

I'm seeing the exact same. 1.72.0 works, latest version gives me the port undefined error

@connor4312
Copy link
Member

Fixed in 749f75d

@Saco93
Copy link

Saco93 commented Jan 29, 2023

Fixed in 749f75d

I'v updated to a recent commit(cf08889), still get the same error.

[dap-js] JS Debugger stderr:                                                                                               
[dap-js] JS Debugger stderr: /Users/sacosong/.local/share/nvim/site/pack/packer/opt/vscode-js-debug/src/vsDebugServer.ts:95
                                                                                                                           
    console.log((result.server.address() as net.AddressInfo).port.toString());                                             
                                                                                                          ^                                                         
TypeError: Cannot read properties of undefined (reading 'toString')                                                        
    at VsDebugServer.launchRoot (/Users/sacosong/.local/share/nvim/site/pack/packer/opt/vscode-js-debug/src/vsDebugServer.ts:95:66)                                                                                                                   
    at processTicksAndRejections (node:internal/process/task_queues:95:5)                                                  
[dap-js] JS Debugger exited with code 1! 

@artemave
Copy link

I am seeing the same as @Saco93 (on v1.75.0)

@connor4312
Copy link
Member

connor4312 commented Jan 30, 2023

Can you please let me know what arguments you're launching the script with?

@jessevanassen
Copy link

nvim-dap-vscode-js, which is where the above reports are coming from, isn't calling the script with any arguments.

It's starting the script here, getting the command and args from get_spawn_cmd. The cmd is the absolute path to Node, and the only argument is the path to vsDebugServer.js, so no additional arguments are passed.

@rzhao271
Copy link
Contributor

What are some verification steps for this issue?

@connor4312
Copy link
Member

  1. Clone js-debug, npm install
  2. Run gulp vsDebugServerBundle
  3. Run node out/src/vsDebugServer.js
  4. Verify that it prints a number to your console (instead of erroring)

@connor4312 connor4312 removed the verification-steps-needed Steps to verify are needed for verification label Feb 24, 2023
@rzhao271 rzhao271 added the verified Verification succeeded label Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants