Debugging

Debug SFCC scripts and pipelines in VS Code with line, conditional, and pipeline node breakpoints, scoped variables, hover evaluation, and a debug console

The extension integrates with VS Code's built-in debugger UI to provide SFCC script debugging

Set a breakpoint in the gutter, start the Salesforce B2C Commerce (SFCC) configuration, and the paused request shows its call stack and variables

Setting Up

Configure Connection

Ensure you have an active sandbox connection configured in the Intellij SFCC sidebar panel

Enable Script Debugger

In Business Manager, go to Administration → Site Development → Development Setup and enable the script debugger

Create Launch Configuration

Open Run and Debug (Ctrl+Shift+D) and add the SFCC configuration. It is intentionally minimal - there is no hostname or code version to fill in, because the debugger uses your active connection from the Intellij SFCC sidebar:

{
  "type": "intellij-sfcc",
  "request": "launch",
  "name": "Salesforce B2C Commerce (SFCC)"
}

The debugger does not read other fields from launch.json. A trace value there has no effect: protocol trace logging is always on

Start Debugging

Press F5 to start the debugger. Set breakpoints by clicking in the gutter - including in .ds files, and in .ts files, which map back to the deployed JavaScript. See TypeScript › Debug on a Sandbox

Only one debugger client can connect at a time. Every launch first resets the script and pipeline debugger clients registered on the instance, so a session that another IDE, debugger tool or teammate has open on the same sandbox ends without notice

Before you start a session

  • Intellij SFCC access. Debugging is a paid feature. Without access, starting a session shows the same notice as other paid features, such as Sign In after the trial or Choose a Plan with Sync Access. See Choose the action you need
  • An account on the connection. The active connection needs a Business Manager account from Credentials. Without one, the session stops with Account not found. Please set account for Sandbox 01 connection.
  • Linked cartridges. Without them, the session stops with Linked cartridges not found. Please link cartridges to the project.

Start from the status bar

When the workspace has linked cartridges and a connection, the status bar shows a debugger button with the tooltip Start Debugger for [connection]. A click starts the SFCC debugger for the active connection, without a launch configuration. While a session runs, the button stops it, with the tooltip Stop Debugger for [connection]

When the connection changes

A running session follows the active connection. Switch to another connection, or change the hostname, code version, account, site or client certificate of the active one, and the debugger restarts for the new target. The notifications read 🛑 Stopping Debugger for Sandbox 02... and then 🚀 Starting Debugger for Sandbox 02.... Renaming a connection does not restart it

Switch several times in a row and the session ends on the last connection you picked. A session that is still starting finishes first and then restarts. If the old session cannot be stopped, no second one starts and a warning that starts with The SFCC debugger could not be restarted on Sandbox 02 gives the reason

When the credentials of the connection change, a running session stops instead, so it does not keep using stale authentication

Debugger Features

Breakpoints

TypeHow to set
Line breakpointClick in the gutter
Conditional breakpointRight-click the gutter, choose Add Conditional Breakpoint..., and enter an expression
Pipeline node breakpointSelect a node in the Pipelines Editor and click Breakpoint
Pipeline ExceptionsCheck it in the Breakpoints view to break when a pipeline throws an exception
Top-Level PipelinesCheck it in the Breakpoints view to break when a top-level pipeline starts

Logpoints, hit counts, and function breakpoints are not supported

Variables Panel

When paused in a script, the Variables panel groups the frame's variables into Local, Closure, and Global, and shows only the scopes that have variables. Expand an object to inspect its members. When paused on a pipeline node, the panel shows the Pipeline Dictionary instead

Values are read-only: the debugger cannot set a variable or an expression

Hover and Debug Console

Hover an expression in the editor while paused to evaluate it. The Debug Console evaluates expressions in the selected frame and completes members after .:

// Evaluate in debug console
product.getName()
basket.getTotalGrossPrice().getValue()
session.getCustomer().isAuthenticated()

Debugging Controllers

Set breakpoints in SFRA controller route handlers:

server.get('Show', function (req, res, next) {
    // 🔴 Set breakpoint here
    var accountModel = getModel(req);
    res.render('account/accountDashboard', {
        account: accountModel
    });
    next();
});

Trigger the breakpoint by navigating to the corresponding route on your sandbox in a browser

Troubleshooting

On this page