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.

Breakpoints aren't working with Next.js app

See original GitHub issue

Issue

I am unable to get a breakpoints to work in a next.js application.

Here’s my current firefox configuration:

{
    "type": "firefox",
    "request": "launch",
    "name": "Debugger:firefox",
    "url": "http://localhost:3000",
    "webRoot": "${workspaceFolder}",
    "skipFiles": [
      "node-modules/**"
    ],
    "clearConsoleOnReload": true,
  }

This properly launches a firefox instance against localhost, however, when I attempt to add a breakpoint in my editor, I end up seeing this popup in my editor:

image

Selecting ‘yes’ for the path mapping wizard does nothing.

Here’s my working chrome configuration for comparison:

{
    "type": "chrome",
    "request": "launch",
    "name": "Launch Chrome against localhost",
    "url": "http://localhost:3000",
    "webRoot": "${workspaceFolder}",
    "sourceMaps": true,
    "smartStep": true,
    "skipFiles": [
      "node-modules/**",
      "interpreter.js"
    ]
  }

Suggestion

This is a bare bones next.js app. Since next.js is becoming more of a popular React.js framework, it might be helpful to have an example in the documentation (provided that this extension is compatible).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jasonwilliamscommented, Feb 26, 2020

Its working better for me too

1reaction
h-jenningscommented, Feb 25, 2020

@hbenl Looks like it’s working much better! I just tested it out in the same app and was able to get it up and running with my previous configuration, with only one additional path map (I was able to use the Path Mappings Wizard for this).

Excited to use this in future projects! Thanks so much for the hard work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

debugging - Why are breakpoints never working in nextjs class?
You first paint is done on node server. so you need to pass --inspect flag to debug the app. Refer: nextjs debugging, nodejs...
Read more >
Advanced Features: Debugging - Next.js
Debugging. This documentation explains how you can debug your Next.js frontend and backend code with full source maps support using either the VS...
Read more >
Debugger thinks the code is further along than where it is ...
In my package.json and running npm run dev. This is the standard method to debug NextJS apps. Again, it works fine on my...
Read more >
Navigate through code by using the Visual Studio debugger
You can use keyboard shortcuts, debug commands, breakpoints, ... To break into the next available line of code in a running app, ...
Read more >
Debugging configurations for Python apps in Visual Studio Code
For general debugging features such as inspecting variables, setting breakpoints, and other activities that aren't language-dependent, review VS Code debugging.
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