Debugging a RESTlet

You can use the NetSuite Debugger to debug RESTlet code in the same manner that you debug other types of SuiteScript code.

If you have installed and set up the SuiteCloud IDE, a debug client is available for your use. The RESTlet/Suitelet Debug Client enables you to debug deployed RESTlet and Suitelet SuiteScripts with the SuiteCloud IDE Debugger. The client is only accessible after a debug session is started. For information about SuiteCloud IDE, see SuiteCloud IDE Plug-in for Eclipse Guide.

Note:

In addition to debugging RESTlet script code, you should test the HTTP request to be sent to the RESTlet. Free tools are available for this purpose, such as Send HTTP Tool (https://www.softpedia.com/get/Internet/Servers/Server-Tools/WIN-HTTP-Sender.shtml).

To debug a deployed RESTlet:

  1. Before you deploy a RESTlet to be debugged, ensure that the script does not include the HTTP authorization header, as this header can prevent the debugger from working.

  2. Ensure that on the script deployment record, the Status value is set to Testing.

  3. Go to Customization > Scripting > Script Debugger.

  4. Click the Debug Existing button in the main Script Debugger page.

    Note:

    This button only appears when you have deployed scripts with the status is set to Testing.

  5. Select the RESTlet script that you want to debug in the Script Debugger popup.

    After you click the Select option button, the RESTlet's cookies display in a banner.

  6. Copy the cookies and paste them into a text file so that you have them available.

  7. Click the Select and Close button in the Script Debugger popup.

    The main Script Debugger page displays a message that it is waiting for user action.

  8. Set the cookies in your client application to the values you copied in step 6, and send the RESTlet request.

    The main Script Debugger page displays the script execution as pending at the NetSuite function restletwrapper(request).

  9. With the script loaded into the Debugger, you can now step through each line to inspect local variables and object properties. You can also add watches, evaluate expressions, and set break points. See Script Debugger Interface for information about stepping into/out of functions, adding watches, setting and removing break points, and evaluating expressions.

Related Topics

SuiteScript Debugger
Debugging Overview
Debugging SuiteScript 1.0 and SuiteScript 2.0 Scripts
Debugging SuiteScript 2.1 Scripts
Script Debugger Metering and Permissions

General Notices