Several limitations are applied to scripts when they run, as detailed below. The limits should be more than sufficient for most scripts and are designed to catch erroneous scripts.
There is a limit of 120 seconds for script executions. After running for 120 seconds, the logs will be collected, and the code will be terminated. Any logs from the first 120 seconds of execution will be logged on the Script Logs page.
There is a limit of 30 seconds for each call made to the API. We impose these timeouts to prevent scripts/API calls from running for a long time period and impacting the performance of the Jira Cloud infrastructure provided by Atlassian.
We cannot change the timeout for each API call, but we can increase the limit of the script execution to a maximum of 240 seconds. If you find you are receiving a timeout error when trying to execute your scripts, please raise a support request.
There is a JVM limitation that relates to the size of methods within scripts. This is imposed by Java rather than ScriptRunner or Jira, as documented in the Atlassian KB. A single method can consist of up to 65536 bytes of bytecodes before the JVM limit returns the error shown below:
General error during class generation: Method code too large
Scripts in ScriptRunner Cloud Storage
Currently, the maximum amount of code that can be stored within Jira Cloud across all ScriptRunner features is 32KB per feature. Note that the exception is the Behaviours feature, which has a limit of 3MB. So, if one Script Listener contains 30KB of code, then all your other Script Listeners must only contain 2KB of code between them.
Please note that our scripts are stored externally from your Jira instance in ScriptRunner Cloud Storage. Our scripts are not part of any Jira exports, meaning that they cannot be automatically migrated between Jira Cloud instances. Currently, it is not possible to migrate your scripts back into Jira Cloud’s storage. If you require a larger amount of storage you can create a support request.
You cannot import external libraries as this is not supported. Whilst you can import packages into your scripts in the Script Console, Script Events and Post-Functions, you can only import from the standard Java 11 classes and the following libraries:
ScriptRunner is built to use the UniRest library as shown in the above list for making REST API calls. This allows you to make a REST API callwith BasicAuthentication using a structure similar to the one outlined below. Remember to make sure you are doing this over HTTPS.
def result = get('/rest/project-templates/1.0/createshared/10005') .basicAuth('firstname.lastname@example.org', 'XXXX') // enter here your username and API token. .asObject(Map) .body