Debugging

Step-through debugging for SFCC server-side scripts

Intellij SFCC integrates with the SFCC Script Debugger to provide a full debugging experience inside your JetBrains IDE.

Setting Up the Debugger

Configure Connection

Complete Configuration, select the development connection in B2C Explorer, and confirm the code version and site scope. Upload the code you intend to debug.

Enable Script Debugger

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

Create and select a debug configuration

Open Run → Edit Configurations, add a Salesforce B2C Commerce (SFCC) configuration. Select that configuration and use the IDE's Debug action. Keep the intended sandbox selected in the plugin toolbar.

Set Breakpoints

Click in the gutter next to any line in a .js controller or script file to set a breakpoint.

The script debugger must be enabled in Business Manager for each sandbox. It's disabled by default for security and performance reasons.

Debugger Features

Breakpoints

TypeDescription
Line breakpointsPause execution at a specific line
Conditional breakpointsPause only when a condition is true
Log breakpointsLog a message without pausing
Exception breakpointsPause on thrown exceptions

Variable Inspection

When paused at a breakpoint, inspect:

  • Local variables - all variables in the current scope
  • Closure variables - variables captured from outer scopes
  • Global objects - session, request, response, customer
  • DW API objects - full property expansion for API objects

Call Stack

View the full call stack with:

  • Navigation to any frame in the stack
  • Variable values at each stack frame
  • Controller → Pipeline → Script chain visualization

Debugging Controllers

Debug SFRA controllers by setting breakpoints in route handlers:

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

Trigger the breakpoint by navigating to the corresponding route in your browser (e.g., https://your-sandbox.demandware.net/on/demandware.store/Sites-Site/default/Account-Show).

Debugging Tips

Pipeline debugging guide

See Pipeline Debugging for node breakpoints, stepping, call stacks, and Pipeline Dictionary inspection.

On this page