Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-4915

Using REST Call for Scripted Field causes Jira to not load properly


    • Type: Bug
    • Status: Triage
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: 6.15.0
    • Fix Version/s: None
    • Component/s: Scripted Fields
    • Labels:
    • Critical Points:


      Using JIRA REST API to populate value to Scripted Field causes Jira to not load properly.

      Steps to Reproduce

      1. Create a new Scripted Field with the following configuration:

        This is the script used:
        import groovy.json.JsonOutput
        import groovyx.net.http.ContentType
        import groovyx.net.http.HttpResponseDecorator
        import groovyx.net.http.RESTClient
        import static groovyx.net.http.Method.*
        final baseURL = "http://localhost:8080/"
        // The host URL will be the consistent prefix to every request is made. i.e: https://<YOUR API HOST URL>/
        // The endpoint will be the specific API method to hit. i.e: /GetResults
        // The query will be the variable parameter the endpoint will use to get the data. i.e: /objectId=1
        // The body is the JSON version of the data that will be sent to an API, only used for PUT and POST
        def getResponse = get(baseURL, "/rest/api/2/issue/TEST-5")
        // If GET response is successful then the response can be cast to a Map which will allow to interact with the data
        if (getResponse) {
            def responseGetMap = getResponse as Map
            // A code to manage the resulted data can be inserted here, i.e iterate results with responseMap.each{}
            responseGetMap.each {}
            log.error responseGetMap.toMapString()
            return responseGetMap.key
        def get(def hostUrl, def endpointAndQuery) {
            // If authentication mechanism of the API is token-based, it can be specified into this variable
            def client = new RESTClient(hostUrl)
            def username = "admin"
            def password = "admin"
            def authorization = "${username}:${password}".bytes.encodeBase64().toString()
                'Accept'       : ContentType.JSON,
                // The 'Authorization' header is added
                'Authorization': "Basic " + authorization
            client.handler.success = { HttpResponseDecorator response, json ->
            client.handler.failure = { HttpResponseDecorator response ->
                // Failure can be handled here
                log.error response.entity.content.text
                path: endpointAndQuery,
                contentType: ContentType.JSON
      2. Add the newly-created field into a project screen.
      3. Create or open an issue to view the Scripted Field.

      Expected Behaviour

      The page loads properly with the Scripted Field showing the issue key from the script: "TEST-5".

      Actual Behaviour

      • Any page in Jira keeps loading non-stop (blank page).
      • No error in the log.
      • No other network activity observed in the Browser tool > Network.


      The only workaround that I found is to manually edit the script via direct database modification to the database table: propertytext to comment out the script.
      A Jira restart is required after the modification.

      After the restart, Jira is working fine again with the Scripted Field not running any script.

      Additional Info

      • The symptom is similar to a stuck thread issue where the application is simply not responding.
      • Restarting Jira doesn't help, it will go right into the issue again (keep loading with a blank page).




            bkek Benz Kek
            0 Vote for this issue
            2 Start watching this issue