Aug 8, 2024

Remote debugging in Heroku

Discover how to easily set up remote debugging for your Node.js app on Heroku, and diagnose issues like a pro with our step-by-step guide!

Author

Shivam PundirShivam PundirSenior Software Engineer - II
Remote debugging in Heroku

Hey there, fellow coder! Have you ever wished you could just step through your Node.js app running on Heroku like a local app? Well, grab your favorite drink and get comfy because we’re about to embark on a fun journey to set up remote debugging on Heroku!

Why Remote Debugging?

Debugging is a crucial part of development, ensuring your app runs smoothly and efficiently. Remote debugging is especially important when your app is deployed on a server, allowing you to diagnose issues that only appear in a deployed environment.

Prerequisites

Before we jump in, make sure you have:

  • A Node.js application deployed on Heroku.
  • The Heroku CLI installed on your machine.

Debugging Steps

Step 1: Enable Remote Debugging

First, we need to enable remote debugging for your Node.js app. Heroku uses the inspect flag to allow remote debugging.

  1. Modify Your Procfile: Add the --inspect flag to your Procfile. It should look something like this:
web: node –inspect index.js

2. Deploy Changes to Heroku: Commit your changes and push to Heroku:

git add Procfile
git commit -m “Enable remote debugging”
git push heroku master

Step 2: Open a Remote Debugging Session

Now that your app is configured, it’s time to connect to the remote debugger.

  1. Restart Your Heroku App: Restarting ensures the inspect flag is applied:
heroku restart

2. Forward Debugging Port: Forward traffic on a local port to a port inside a dyno; in this case both the local port and dyno port are 9229:

heroku ps:forward 9229

Step 3: Connect Your Debugger

With the SSH tunnel set up, you can now connect your favourite debugger. 

Using VS Code

  1. Open VS Code: Launch VS Code and open your project.
  2. Configure Debugger: Add a new configuration in your launch.json:
{
   "version": "0.2.0",
   "configurations": [{
       "address": "localhost",
       "localRoot": "${workspaceFolder}",
       "name": "Attach to Remote",
       "port": 9090,
       "remoteRoot": "/app",
       "request": "attach",
       "skipFiles": ["<node_internals>/**"],
       "type": "node",
   }]
}

3. Start Debugging: Select the "Attach to Heroku" configuration and start debugging. Set breakpoints, inspect variables, and step through your code like in a local environment.

Using IntelliJ IDEA / Webstorm

  1. Open Run Config: Open your IDE and go to Run > Edit Configurations. 
  2. Configure Debugger: Click the + button and select Attach to Node.js/Chrome:

3. Start Debugging: Select your newly created Node.js Remote Debug configuration, Click the debug icon and start debugging. Set breakpoints, inspect variables, and step through your code like in a local environment.

And there you have it! You’ve just set up remote debugging for your Node.js app on Heroku. High five!  Debugging in the cloud just became a whole lot cooler, right? If you hit any bumps along the way, double-check your SSH tunnel and configurations. Happy debugging!

Subscribe to Our Newsletter

RELATED ARTICLES

More from the engineering frontline.

Dive deep into our research and insights on design, development, and the impact of various trends to businesses.
The Bug That Doesn't Show Up in Code Review: Why Your Flutter Web App Reloads on Safari
The Bug That Doesn't Show Up in Code Review: Why Your Flutter Web App Reloads on Safari
A real-world look at how oversized images can trigger Safari reloads and iOS crashes in Flutter apps and how smarter image decoding prevents them.
From Prompting to Process: What Changed When Flutter Shipped Agent Skills
From Prompting to Process: What Changed When Flutter Shipped Agent Skills
This blog explores how Flutter Agent Skills improve AI-assisted development by combining official framework workflows with project-specific guidance for more consistent development.
Why Everything Your AI Builds Looks the Same
Why Everything Your AI Builds Looks the Same
This blog explores why AI-generated interfaces often look alike and explains how design systems, product context, and reusable engineering practices help teams build distinctive, scalable
How We Built the Missing Bridge from Code to Figma
Technology

Jul 10, 2026

How We Built the Missing Bridge from Code to Figma
This blog explores how AI-generated React apps get turned into fully editable, designer-ready Figma files by reading React Fiber instead of the DOM.
Building a Resilient Hybrid-Cloud Network with WireGuard HA, Route-Based Failover, and Deep Observability
Technology

Jun 27, 2026

Building a Resilient Hybrid-Cloud Network with WireGuard HA, Route-Based Failover, and Deep Observability
A practical breakdown of building resilient AWS-to-on-premises connectivity with WireGuard HA, active-standby failover, and deep packet-forwarding observability.
We Built a 114-Second AWS-to-Azure Failover. Here’s What We Learned
Technology

Jun 19, 2026

We Built a 114-Second AWS-to-Azure Failover. Here’s What We Learned
A practical guide to building a 114-second multi-cloud disaster recovery failover between AWS and Azure — what we built, what broke, and what we learned.
Cloud-Native and Cloud-Agnostic Are Not Ideologies; They Are Business-Stage Decisions
Technology

Jun 12, 2026

Cloud-Native and Cloud-Agnostic Are Not Ideologies; They Are Business-Stage Decisions
This blog explains how organizations can balance speed, scalability, and operational flexibility as they grow from startup to enterprise scale.

The Right Conversation Can Save You Six Months.

Whether you’re navigating AI adoption, modernizing legacy systems, or scaling a product - we start by listening. No pitch deck. No template. A real conversation.