Skip to content

Node-RED Debug Message — Complete Guide

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Node. We cover key concepts, practical examples, and best practices.

Hook

You connect a Debug node to a wire, deploy, and expect to see messages in the Debug sidebar. The sidebar stays empty. You double-check the wire — it is connected. You re-deploy — still nothing. Your debugging is blind.

The Wrong Way

Adding more Debug nodes on the same wire does not help — if the first Debug node shows nothing, a second one connected to the same output will also show nothing.

# BAD: Adding duplicate Debug nodes
msg → [Debug node 1] → [Debug node 2] → [Function node]
Debug sidebar: empty
Two Debug nodes — both silent
The problem is upstream of the Debug nodes

More Debug nodes do not create messages that do not exist.

The Right Way

Check the message flow upstream and ensure the Debug node is configured correctly.

# 1. Check if the node sends messages at all
# Add a Debug node directly to the inject or input node
[inject node: timestamp] → [Debug node]
Debug sidebar:
(10:00:00) msg.payload: 1719212400000

If this works, the upstream (inject) is fine. The issue is between the inject and your original Debug node.

# 2. Check your Debug node's output filter
# Double-click the Debug node → "Output" setting:
# BAD: Filtered to "msg.payload" but payload is undefined
Output: msg.payload
# GOOD: Show entire message object
Output: msg
# Or: Output: msg.payload
# 3. Check if the node sends to the Debug tab correctly
# Debug node → "To:" → Select "debug window" (not "system console" or "file")
# 4. Enable debug logging in settings.js
# In ~/.node-red/settings.js:
debugAppend: true,
# 5. Check the browser console
# F12 → Console → Look for WebSocket errors
WebSocket connection to 'ws://localhost:1880/comms' failed

The WebSocket connection between the editor and runtime is broken. Reload the editor.

Prevention

  • Set Debug node output to msg (full message object) during development.
  • Connect a Debug node to the first node in your flow before adding logic.
  • Confirm the WebSocket connection is active (green dot in editor footer).
  • Use the Timeline tab in the Debug sidebar for ordered event viewing.
  • Clear the Debug sidebar between test runs to avoid confusion.

Common Mistakes with red debug msg

  1. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
  2. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  3. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks

These mistakes appear frequently in real-world NODE code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

Why does the Debug node show 'undefined'?

The message property you selected in the Debug node does not exist on the message object. Change the output to msg to see all properties, or check which properties the upstream node sets.

Can I send debug messages to a file?

Yes — set the Debug node's "To" option to "file" and specify a path. This is useful for long-running flows where the browser debug sidebar is not practical.

What is the difference between debug and console nodes?

The Debug node sends messages to the editor's Debug sidebar (via WebSocket). The Console node writes to the Node-RED server's stdout/stderr visible in system logs or journalctl.


DodaTech — debug messages that actually appear.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro