Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Heroku Engineering 4 min read How-to mediumAdept

Let’s Debug a Node.js Application

Node.js debugging options range from structured logging to post-mortem analysis. Use leveled loggers like Pino or Winston instead of console.log, set breakpoints and take heap snapshots via `node --inspect-brk` with Chrome DevTools, an IDE, or ndb (which supports edit-in-place), and analyze native crashes with llnode on core dumps produced by `process.abort`. The debug module filters namespaced log output through the DEBUG environment variable, while trace and clarify improve async stack traces locally but should not run in production.

Related posts

  • Remote Debugging with SSH and VS Code

    Render mediumAdept

    A Node.js process running on Render can be debugged from a local VS Code instance by starting it with `node --inspect=9229` and forwarding the debug port over an SSH tunnel (`ssh -N -L 9229:localhost:9229`). This avoids exposing the inspector port publicly. VS Code attaches through a launch.json "Attach to Remote Program" config with remoteRoot set to the deploy directory. Once attached, breakpoints, variable inspection, call stacks and break-on-exception all work as they do locally, which helps with bugs that only reproduce in the production Linux environment. The Flame Chart Visualizer extension adds live CPU and memory profiling over the same connection.

  • The Debugger is Here

    Zed mediumAdept

    Zed now ships a native debugger built on the Debug Adapter Protocol, with out-of-the-box support for Rust, C/C++, JavaScript, Go and Python. "Locators" turn build tasks such as Cargo runs into debug configurations automatically. Internally it uses a two-layer design: a data layer talks to debug adapters, caches responses by request arguments, lazily fetches and invalidates stale state, and a UI layer queries only what it renders, which sets up future collaborative debugging. Extensions can plug in any of the 70+ DAP implementations, and inline variable values come from Tree-sitter scope queries rather than the LSP inline-values request.

  • Improving Firefox stability on Linux

    Mozilla Hacks mediumAdept

    Mozilla went from being able to symbolicate under 20% of Linux Firefox crash reports to over 99% by scraping debug information for distro-packaged Firefox builds and their dependencies (GTK, Mesa, fontconfig, SQLite, etc.) from Arch, Debian, Fedora, OpenSUSE and Ubuntu repositories. The scripts convert that debug info into Breakpad symbol files, which the Socorro crash processor uses to turn minidumps into readable stack traces. With those traces the team caught distro-specific regressions such as a Debian fontconfig backport bug within days and sent fixes upstream to Mesa, GTK and glib. The crash analysis tooling was also rewritten in Rust on top of Sentry's crates, making it much faster and lighter on memory.

  • Four Approaches to Debugging Server-side WebAssembly

    Shopify Engineering mediumAdept

    Step-debugging server-side WebAssembly can be done four ways: compiling to a native target and using LLDB/GDB, running the Wasm under Wasmtime inside LLDB, using a Wasm-specific debugger like Wasminspect, or using browser DevTools via Chrome's DWARF extension or source maps. Native compilation gives the best variable rendering and familiar tooling, and is the only option for interpreted languages, but may require stubbing imported functions and cannot reproduce Wasm-specific behavior. The other approaches suffer from lower-fidelity variable rendering, missing features, or harness setup. The recommendation is to debug natively by default and fall back to Wasmtime+LLDB or browser tools when bugs only reproduce in a Wasm engine.

  • How to get deep traces in your Node.js backend with OTel and Deno

    Deno mediumAdept

    Running an unmodified Node.js Express server under Deno 2.2+ with the `--unstable-otel` flag yields OpenTelemetry traces and span-correlated logs with no code changes. Deno auto-instruments `console.log`, `fetch` and `Deno.serve()`. The comparison is a small ChatGPT-backed chat app viewed in Grafana's otel-lgtm Docker stack (Tempo for traces). The plain-Node route needed eight @opentelemetry dependencies, an 84-line telemetry.js configuring NodeSDK exporters and HTTP instrumentation, and a custom logger that attaches trace IDs. In Deno, a few environment variables are enough, though the feature is still experimental.

The quest for software engineering knowledge.

Look:
Layout: