Debugging
Integrated script debugger for SFCC in VS Code
The extension integrates with VS Code's built-in debugger UI to provide SFCC script debugging.
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)",
"trace": false
}Set trace to true to log the debugger's protocol traffic when troubleshooting.
Start Debugging
Press F5 to start the debugger. Set breakpoints by clicking in the gutter - including in .ts and .ds files, which map back to the deployed JavaScript. See TypeScript › Debug on a Sandbox.
Only one debugger client can connect at a time. Ensure no other IDE or debugger tool is connected to the same sandbox.
Debugger Features
Breakpoints
VS Code's full breakpoint support:
| Type | How to Set |
|---|---|
| Line breakpoint | Click in the gutter |
| Conditional | Right-click gutter → Add Conditional Breakpoint |
| Logpoint | Right-click gutter → Add Logpoint |
| Exception | In Breakpoints panel, enable "Uncaught Exceptions" |
Variables Panel
When paused, the Variables panel shows:
- Local - variables in current scope
- Closure - captured variables from outer scopes
- Global -
session,request,response,customer - DW Objects - expand DW API objects to inspect properties
Debug Console
Use the Debug Console to evaluate expressions while paused:
// 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.