Skip to content

Debugging Scripts

The GenAIScript script files are executable JavaScript and can be debugged using the Visual Studio Code Debugger, just like any other JavaScript program.

A screenshot of a debugging session in a code editor with a breakpoint set on a line of code. The editor is displaying several panels including the watch variables, call stack, and a terminal output. The code is partially visible with a function definition and JSON configuration data.

Starting a debugging session

  • Open the .genai.js file to debug and add breakpoints.

From the env files

  • Right click in the editor of the file you want in env.files.
  • Select the GenAiScript from the picker.

From the script itself

  • Open side-by-side the GenAIScript source and the files you want in env.files.
  • Right click in GenAIScript editor and click Debug GenAIScript….

The debugger will launch the cli and run the script in debug mode. The debugger will stop at the breakpoints you set.

Limitations

The JavaScript executes in an external node process. Therefore,

  • The trace preview and output is not supported while debugging.

Next steps

Keep iterating the script or automated it in your CI/CD.