Does Script Runner work with Webhooks

I have tried setting up a webhook using JQL by Script Runner and the hook never appears to fire. Is this possible to setup? I tried using standard JQL and it worked fine and I tried the Script Runner JQL in the issue browser so I know that both parts work independently but don't work together

I am trying to do the following:

issueFunction in linkedIssuesOf("issuetype = Epic and resolution is empty", "is epic of")

1 answer

0 vote

As far as I can see it works, I tested with:

issueFunction in hasSubtasks()

Can you go to one of the issues you think the hook should fire on, let's say the key is JRA-1.

Then try to run the query:

issueFunction in linkedIssuesOf("issuetype = Epic and resolution is empty", "is epic of") and key = JRA-1

Does this return the one issue? If not maybe you have your links the wrong way round. 

What events are you listening for?

 

Hi Jamie,

Thanks for coming back. I have just tested this as you said and I can see that it does find the issue as expected.

The events are just issue created or updated.

Thanks

Could you try with the simple query I used? 

There is no logging in the relevant class so I can't give you anything to show that that fired or not.

 

@Jamie Echlin [Adaptavist] - I've recently run into this as well and have been playing around with this the last 2 days. I set up a bogus URL so I see the webhook failures in my log file. I easily set up a web hook for both events & on post functions using a regular JQL search. Then I tried setting up a webhook using ScriptRunner JQL functions on a post function. I noticed something peculiar. The original JQL I was using with my webhook was issuetype = 'A' and issueFunction in subtasksOf('issuetype = B and issueFuncion in linkedIssuesOf("issuetype = C and labels = a-label", ALink)'). I double checked to make sure that the issue I tested on matched the JQL. Nothing appeared in the log (neither the expected failed webhook call or a failure in starting the webhook). I tried other randomish ScriptRunner JQL functions with the same result (nothing). Then I tried issuetype = A and issueFunction in hasLinkType("Duplicate") (I tried this because there are very few ~300 matches and it's fairly simple JQL). This fired the webhook. I wonder if this is because of how long the JQL searches take. I'm not sure how to go about testing this though.

How long does the long-running query take? In the most recent version there is a profiler thingy - https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_query_profiler - which will show you how long it takes. But, I don't remember see any reference to a timeout when I looked at the code.

 

I even artifically made the query take 2 seconds and it still worked. 

Can you set the log level to debug for com.atlassian.webhooks , run again, and post the logs.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

365 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you