Skip to content

Latest commit

 

History

History
11 lines (8 loc) · 767 Bytes

node-debug-async-await.md

File metadata and controls

11 lines (8 loc) · 767 Bytes

Debugging async/await when default stack traces are not helpful

The issue with stack traces is described perfectly here nodejs/node#11865 (comment).

One way to solve this is to use ndb. Steps to solve:

  1. Move the script you're testing to an npm script (so it can be run npm run my-script). This helps ndb to discover the script.
  2. Go to your project directory root and run npm i -g ndb && ndb. Debugger window should open up
  3. From top-right icons, click the one which says "Pause on exceptions"
  4. Then run your my-script from bottom-left in the window
  5. When the exception is thrown, you'll be able to see the whole stack trace under "Call stack" in the right column.