The Remote Debugger lets you connect to YouTrack and debug workflow scripts using the standard functionality of your favorite IDE. The debugger loads scripts from YouTrack to your IDE, where you can debug them with the tools you're accustomed to.
Using the Remote Debugger requires a JetBrains IDE with the YouTrack Integration Plugin installed and set up.
Before debugging any YouTrack scripts in your IDE, you need to prepare the environment.
On the YouTrack side, check the following:
The Remote Script Debugger feature is enabled in YouTrack. This feature is group-specific, which means that only members of specific groups can use it. By default, this flag is enabled for the All Users group.
For details on how to manage optional features in YouTrack, see Optional Features.
You have sufficient permission to debug scripts.
To debug a workflow, you need to have the Update Project permission in at least one project where the target workflow is attached.
If your YouTrack Server Installation is working behind a reverse proxy, the reverse proxy is configured according to the documentation. For more details, see Reverse Proxy Configuration.
On the IDE side, check the following:
Your IDE is one of the JetBrains IDEs based on the IntelliJ Platform. This includes AppCode, CLion, DataGrip, GoLand, IntelliJ IDEA, PhpStorm, PyCharm, Rider, RubyMine, and WebStorm.
If you're using IntelliJ IDEA, the Ultimate edition is required.
If you're using PyCharm, the Professional edition is required.
The version of your IDE is 2021.1 or later.
YouTrack Integration Plugin is installed, up-to-date, and connected to YouTrack. The minimum required version of the plugin is 2021.4.1.
For details on how to install the YouTrack Integration Plugin and connect it to YouTrack, see YouTrack Integration Plugin.
Set up the Remote Debugger
When you've prepared your IDE and the YouTrack Integration Plugin, you need to set up the debug configuration to start debugging scripts.
To add a debug configuration:
In your IDE, open the Edit Run/Debug Configurations dialog.
Click the Add New Configuration button to start creating a new debug configuration.
From the list of debug templates, select YouTrack Debug.
The edit form for a new debug configuration for YouTrack opens.
In the edit form, set the name for the debug configuration and the root folder where the IDE will download the scripts from YouTrack.
The debug configuration for YouTrack scripts is created.
Load Scripts from YouTrack
To start working with a particular script, you need to load all available scripts from YouTrack to your IDE.
To load workflow scripts from YouTrack:
Start a debugger session using the configuration you've created. Select the YouTrack debug configuration in the run/debug configurations list, and press Debug.
Wait until the debug window opens and the scripts appear in the project tree.
A debugger session starts.
The workflow scripts from YouTrack get loaded to your IDE. Local copies of these scripts are created in your project in the IDE.
The workflow scripts that are available for debugging appear in the tree in the debug window.
In the Event Log, you can see the list of scripts that were recently loaded.
When a debugger session starts, the IDE starts to listen to events on the YouTrack side and react to the changes relevant to a particular script. You can interfere with the script execution using breakpoints, step through the script, evaluate expressions and do anything the IDE debug tools allow.
For more information on debugging in IntelliJ IDEA, see Debug Code.
To ensure that debugger sessions interfere with the normal YouTrack functioning as little as possible, YouTrack limits the sessions as follows:
YouTrack allows only one active debugger session per user.
If a debugger session shows no activity for 5 minutes, it's interrupted. When a session is interrupted or stopped manually, all breakpoints become inactive and will be removed at the start of the next session.
Breakpoints stop script execution for no longer than 4 minutes. After this timeout, script execution resumes automatically.
When you've loaded scripts from YouTrack, you can start debugging them as you normally would debug any other script.
At the moment, you can only debug workflow scripts. Debugging import scripts will be supported later.
Debug Workflow Scripts
To use the debugger with a workflow rule, start a debugger session, add breakpoints, and emulate the situation in YouTrack when the workflow triggers. For example, if you're debugging an on-change rule, make the change that triggers this rule.
When a breakpoint is hit, you can examine the state and behavior of the script. YouTrack remains fully functional at this time.
If you decide to modify the script after a debugger session, make changes on the YouTrack side. To continue debugging the modified script, start a new debugger session. YouTrack will load the updates at the start of the new session.
Here you can find information on the common problems with the Remote Debugger and how to solve them.
Errors when starting a debugger session.
The scripts are not loaded to the debug window.
First, check the following:
If the above steps don't help resolve this problem, clean the project and recreate the debug configuration as follows:
If you continue facing issues with the debugger, collect the logs and ask for help from the YouTrack support team.
Restart the debugger session and reproduce the error, then collect the logs of your IDE and submit a ticket to YouTrack support. Attach the full YouTrack logs to the ticket.
Breakpoints don't have checkmarks.
Check whether the scripts are loaded in the debug window. If they do not appear in the debug window, resolve this problem first.
If a breakpoint doesn't have a checkmark, it means that it's not active and it will not stop the script execution.