question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSCode Debugging broke after upgrading from version 9.2.2 to 9.3.0

See original GitHub issue

Bug report

Debugging through VSCode no longer works

Describe the bug

When running debugger through VSCode console after upgrading from version 9.2.2 to 9.30 the console spams “Starting inspector on 127.0.0.1:9229 failed: address already in use” but the address is not in use.

baydash on master [!] is 📦 v1.0.0 via ⬢ v12.13.0 on ☁️  us-east-2 
❯  cd /Users/crazypanda/Workspaces/baydash ; env NODE_OPTIONS=--inspect-brk /usr/local/bin/node node_modules/.bin/next 
Debugger listening on ws://127.0.0.1:9229/61643430-1b26-4c6b-864e-6413d4daf6b9
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
[ wait ]  starting the development server ...
[ info ]  waiting on http://localhost:3000 ...
Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use

To Reproduce

  1. Use Next.js version 9.3.0
  2. Create a Next.js app
  3. Create a launch.json file (for VSCode)
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug App",
            "program": "${workspaceFolder}/node_modules/.bin/next",
            "port": 9229,
            "console": "integratedTerminal",
            "cwd": "${workspaceFolder}",
            "env": {
                "NODE_OPTIONS": "--inspect-brk"
            }
        }
    ]
}

In VSCode run the debugger image

Expected behavior

Should not say “Starting inspector on 127.0.0.1:9229 failed: address already in use”. The server should run and you should be able to set breakpoints in VSCode.

image

System information

  • OS: MacOS
  • Browser (if applies) Microsoft Edge (Chromium)
  • Version of Next.js: 9.3.0

Additional context

This does not happen in version 9.2.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
realfunkyusernamecommented, Apr 6, 2020

@chadalen and what do I do if I use TypeScript? Placing a breakpoint shows a warning that SourceMaps aren’t found. Using "sourceMap": true didn’t help

1reaction
chadalencommented, Mar 19, 2020

Going to close this ticket. I was able to get debugging in VSCode working by removing --inspect-brk. Seems like Next version 9.3.1 calls --inspect under the hood. See https://github.com/zeit/next.js/issues/11030#issuecomment-598622967

This VSCode launch.json works for me.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug App",
            "program": "${workspaceFolder}/node_modules/.bin/next",
            "console": "integratedTerminal",
            "cwd": "${workspaceFolder}"
        }
    ]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode Debugging broke after upgrading from version 9.2.2 ...
Bug report Debugging through VSCode no longer works Describe the bug When running debugger through VSCode console after upgrading from ...
Read more >
Debugging in Visual Studio Code
One of the great things in Visual Studio Code is debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
November 2022 (version 1.74) - Visual Studio Code
For the best experience, upgrade debugpy in your environment to >=1.6.3 . Previously, the debugJustMyCode setting was only respected when debugging in the ......
Read more >
Visual Studio Code Frequently Asked Questions
Visual Studio Code is a streamlined code editor with support for development operations like debugging, task running, and version control.
Read more >
Changelog - Cypress Documentation
Fixes #24915. Fixed an issue where the incorrect Cypress version could be shown in the migration wizard.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found