Debug NodeJS applications with Docker

Stefan Pöltl
5 min readFeb 22, 2021

You covered your codebase with unit tests but you’re still facing some weird bugs from time to time and don’t know how to find the issues in your web application, serverless endpoint or cron job script? This post will guide you through the pain of setting up debuggers in your IDE and describes how a debugger works in detail.

All the code used in this post can be found here: https://github.com/stefpe/node_debugging

What is debugging?

Debugging means to find a bug/anomaly in your code/program. Normally you can use a debugger to start your program in a monitoring mode to see what happens by stepping through the code line by line(Interactive debugging).

Which methods are common to find bugs:

  • print debugging (console API -> console.log(‘Hello’);)
  • Interactive debugging(step through debugging)
  • Remote debugging / Debug a remote application with a local debugger tool

In this post we will checkout the interactive debugger and actually its some kind of remote debugging, because we run apps in a container.

Debug Node scripts with the help of Google Chrome

--

--