Hi,
I have a scriptrunner/groovy script that will be called on an "issue changed" event in Jira Cloud and checks at the very beginning whether the current issue belongs to an open sprint using a call to the search api:
// ************************************* script **************************************
logger.info("current issue: ${issue.key}")
def jqlIssue = 'project = LKAPPL AND issueKey="'+ issue.key +'" AND Sprint in OpenSprints()'
logger.info("JQL query: ${jqlIssue}")
def findIssue = get("/rest/api/3/search")
.queryString("jql", jqlIssue)
.asObject(Map)
.body
.issues as List<Map>
if (findIssue.size()<=0){
logger.info("Issue ${issue.key} does not belong to the current sprint")
return
}
// ... remaining code (automatic numbering of agenda items) omitted
// **********************************************************************************
Usually, the above script works fine:
***************************** successful execution log *****************************
2023-11-09 14:34:20.918 INFO - current issue: LKAPPL-619
2023-11-09 14:34:20.920 INFO - JQL query: project = LKAPPL AND issueKey="LKAPPL-619" AND Sprint in OpenSprints()
2023-11-09 14:34:21.661 INFO - Serializing object into 'interface java.util.Map'
2023-11-09 14:34:21.662 INFO - GET /rest/api/3/search?jql=project+%3D+LKAPPL+AND+issueKey%3D%22LKAPPL-619%22+AND+Sprint+in+OpenSprints%28%29 asObject Request Duration: 739ms
2023-11-09 14:34:21.664 INFO - Issue LKAPPL-619 does not belong to the current sprint
************************************************************************************
Sometimes, however, this check creates the following error in the log (and execution fails):
******************************** failing execution log *******************************
2023-11-09 14:34:19.662 INFO - current issue: LKAPPL-619
2023-11-09 14:34:19.683 INFO - JQL query: project = LKAPPL AND issueKey="LKAPPL-619" AND Sprint in OpenSprints()
2023-11-09 14:34:21.569 INFO - Serializing object into 'interface java.util.Map'
2023-11-09 14:34:21.572 INFO - GET /rest/api/3/search?jql=project+%3D+LKAPPL+AND+issueKey%3D%22LKAPPL-619%22+AND+Sprint+in+OpenSprints%28%29 asObject Request Duration: 1847ms
2023-11-09 14:34:21.573 WARN - GET request to /rest/api/3/search?jql=project+%3D+LKAPPL+AND+issueKey%3D%22LKAPPL-619%22+AND+Sprint+in+OpenSprints%28%29 returned an error code: status: 403 - Forbidden
body: java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (StringReader); line: 10, column: 2]
2023-11-09 14:34:21.602 ERROR - Cannot get property 'issues' on null object on line 8
2023-11-09 14:34:21.608 ERROR - Class: com.adaptavist.sr.cloud.events.WebhookExecution, Config: null
*************************************************************************************
Does anybody have an idea what the problem might be? Any idea welcome, in particular hints how to track those kinds of problems better than just by logging.
Best,
UweC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.