How to troubleshoot JIRA Service Management Project Automation Webhook failure?

Marlene Koh June 30, 2021

I am using JIRA Service Management Data Center v4.12.2.

I am trying to use a project automation webhook to grant access to end-users.

 

From the Jira Server Developer Docs: https://developer.atlassian.com/server/jira/platform/jira-service-desk-webhooks/

  • Success criteria and timeout -- A webhook HTTP POST request is considered successful if the server returns a response with status code range 200 (inclusive) to 300 (exclusive). Jira Service Desk waits 5 seconds to establish a TCP connection with the webhook server, and 20 seconds for a response after connection is established. If the webhook requests fails, Jira Service Desk does not retry the connection.

 

However, this behaviour is not observed. If my JIRA Service Desk Project Automation webhook fails with error 401, 404, 405, etc, the automation logs still show "Success" immediately.

I know that as a JIRA sysadmin, you can use scriptrunner or other automation plugins to curl and check if the webhook has been executed successfully and the access has been granted. But this only works if I am a JIRA sysadmin.

 

How can I troubleshoot webhook failures as a JIRA user / project admin (not JIRA sysadmin)? Thanks very much!

2 answers

0 votes
Daniel Ebers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 4, 2021

Hi @Marlene Koh

according to this Suggestion there is no possibility to see logs of webhooks other than looking into the logfiles (the last one, you showed): https://jira.atlassian.com/browse/JRASERVER-39361

Do I understand it correctly the live system is getting back an error 404? This would suggest there is no resource found on the destination - did I get you right that it works some times but other times it do not?

For the last qustion, the issue key seems to be replaced by the URL the customer sees (second line of your log snippet). This seems to be because the context is executed in the context of Jira Service Manager rather that Jira. I am not aware of any way to adjust this.

So - in general the question would be why the webhooks are not reaching the destination system all the time or better said why there is a 4**-error code from time to time, isn't it?

Regards,
Daniel

Marlene Koh July 5, 2021

Hi Daniel,

Thank you for your answer!

Yep I was intentionally giving an example log for 404, but I would like to be able to trace which ticket triggers the webhook that results in the 404 (i.e. is there a way to make the logs print the ticket number?). It seems like there's no way to track.

 

My workaround now is that I configure a JSD automation to hack a "retry webhook" process.

1. When a user creates a webhook, I execute the webhook and transition the ticket from To Do > In Progress > Done.

2. In the workflow, I check "Show this transition on the customer portal" to allow users to transition back from Done > In Progress. This will trigger another automation rule that calls the webhook again that transitions the ticket from In Progress > Done. I also add a label "webhook-failed".

3. Finally, I let the user know that the webhook has been triggered again via a public comment.

4. If the user triggers the transition from Done > In Progress again, I leave the ticket in In Progress and do not transition the webhook. This allows service desk agents to look at the issue. (Can also set an issue filter email subscription for Open issues with the "webhook-failed" label)

 

I know this is a hacky workaround but it works as a hotfix. I don't particularly like it though because JSD webhooks are not exportable/cannot be version controlled. If there is a better way to implement error handling or webhook retries I am all ears to hear it :)

Thanks so much again!!

Cheers!

Daniel Ebers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 5, 2021

One question: is this the Automation built-in into Jira Service Management or the "Automation" App this is available separately? I could not identify it from the error messages and the description could be understood either way.

From my point of view this is even a pretty advanced and well-thought through approach - as you can see in the Suggestion I have linked there is a demand for improvement. I don't think you can do it any better like in your example.

Marlene Koh July 5, 2021

This is the default Automation built-in into Jira Service Management.

 

I see, thanks for your help!

0 votes
Marlene Koh July 1, 2021

2021-07-02 09:25:38,026+0800 PsmqAsyncExecutors-then:thread-15 WARN admin 562x813x1 lvxiud 172.21.0.1,172.21.0.2 /servicedesk/customer/portal/1/create/8 [execution.engine.asyncthen.AsyncThenJobProcessor] Failed executing ThenAction com.atlassian.servicedesk.plugins.automation.webhook.rulethen.WebhookThenAction asynchronously: 'Received [404 - Not Found] when posting to webhook URL http://webhook.site/doesnotexist'

Logs that I receive in atlassian-servicedesk.log.

is it possible to get the issue key printed?

Suggest an answer

Log in or Sign up to answer