2.1 Script Debugger Overview
Script debugging is an important part of the holistic developer experience. Debugging with Chrome DevTools is the most common way to debug JavaScript. In our effort to offer a modern coding experience to our developers, we have developed the 2.1 Script Debugger using Chrome DevTools to allow users to debug their scripts using similar functionality available when debugging JavaScript in the Google Chrome browser.
The 2.1 Script Debugger is accessed the same way as the legacy Script Debugger used for SuiteScript 1.0 and SuiteScript 2.0 scripts. To use the 2.1 Script Debugger, select 2.1 as the API Version on the Script Debugger page. When you click Debug Script, a new browser tab opens providing you with the Chrome DevTools interface for debugging your script. Your script will be displayed on the new tab and you will be able to pause/resume execution, set breakpoints, and step through your code line by line.
The 2.1 Script Debugger is available for all SuiteScript developers.
Only SuiteScript 2.1 scripts can be debugged using the 2.1 Script Debugger. You cannot use the 2.1 Script Debugger to debug SuiteScript 1.0 or SuiteScript 2.0 scripts.
In 2021.1, the following SuiteScript 2.1 server script types can be debugged:
-
Scheduled scripts
-
Suitelets
-
User event scripts
Debugging of SuiteScript 2.1 versions of other script types and core plug-in implementations is planned to be supported in a future NetSuite release. Also, debugging "Hidden in SuiteBundle" files is not currently supported. See Add the Bundle Installation Script File to the File Cabinet for information about the Hide in SuiteBundle option for Bundle Installation scripts.
Currently, only one script can be debugged at a time in a given debug session, regardless of the version of the script. You cannot debug a SuiteScript 2.0 script at the same time as a SuiteScript 2.1 script.
The following table lists the debugging capabilities provided by Chrome DevTools along with an indication of whether the capability is supported in the 2.1 Script Debugger in the 2021.1 release. See Using Chrome DevTools for instructions on each capability.
Most common debugging capabilities in Chrome DevTools for JavaScript code |
Supported in 2.1 Script Debugger |
---|---|
Pause your code with breakpoints |
✓ |
Find unused script code |
✓ (see Chrome DevTools documentation) |
Map preprocesses code to source |
— |
Change thread context |
— |
Step through code:
|
✓ |
Set and remove breakpoints |
✓ |
Edit code |
— |
View and edit local, closure, and global properties |
✓ |
View current call stack |
✓ |
Copy stack trace |
✓ (see Chrome DevTools documentation) |
Ignore a script or pattern of scripts |
✓ (see Chrome DevTools documentation) |
Blackbox a script from the Editor pane, the Call Stack pane, the Settings pane |
✓ (see Chrome DevTools documentation) |
Display the console |
✓ |
Use the Memory tab |
— |
Use the Profiler tab |
— |
Searching |
✓ |
Code coverage |
✓ |
Hover over code components shows info and values |
✓ |
De-minify the code |
✓ |
Set up a workspace |
— |
Keyboard shortcuts |
✓ See https://developers.google.com/web/tools/chrome-devtools/shortcuts |