Why do I get 401 Client Error when using a webhook to post to Microsoft Flow? Edited

We have seen this issue since the beginning of last month, and we have not been able to get the webhook to work with Flow directly.

I created a temporary solution, where I made a NodeJS Server that would receive the webhook events and would then post to Microsoft Flow. Although this worked fine, this is not a solution we would like, since we would have to host our NodeJS Server. Note, when I opened up a POST request on my node server (using express via `app.post`, I noticed that JIRA would not send the events to me via the webhook. It didn't work until I used `app.all`, which means it would accept all requests (GET, PUT, POST, and DELETE). Once all requests were there, JIRA started to work fine.

Because we received this error on the Cloud product as well. This is when we tried to do this same thing on my self-hosted server. We noticed that it did the same thing when talking to flow directly. it gave the following error -- which I'm sure, the cloud version is doing the same. In the log found in "C:\Program Files\Atlassian\Application Data\JIRA\log\atlassian-jira.log", I found this error occuring everytime a new event occurs in JIRA:

2017-09-28 10:44:37,802 httpclient-callbacks:thread-1 WARN anonymous [c.a.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] Client error - 401 when posting to web hook at 'https://prod--61-westus-logic-azure-com.mstools.apps.verisk.com:443/workflows/ba4f06a4bb9e447fa97020d0dd9a5aa5/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=j75YAyjbSkzTQ2iLA3ZU5H9rVDEMHpSH-2wSraNNDDc'

Steps to reproduce:
1. Create a webhook in JIRA
2. use this as the url for the webhook to POST to:
https://prod--61-westus-logic-azure-com.mstools.apps.verisk.com:443/workflows/ba4f06a4bb9e447fa97020d0dd9a5aa5/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=j75YAyjbSkzTQ2iLA3ZU5H9rVDEMHpSH-2wSraNNDDc
3. Select all checkboxes in the webhook config.
4. Click save
5. Create or update an issue in any board.
6. The logs should be displaying the error above


This is a very important thing to fix for us, since we do not want to host a "middle-man" application to integrate with JIRA. I have a few screenshots in the description, as well as the log file.

1 answer

1 accepted

1 votes

I found a similar support case for Jira where another user found a solution to a similar problem by adjusting the webhook URL to replace the '%2F' strings in that URL with '/' characters (no quotes for either).   Try changing your URL from:

https://prod--61-westus-logic-azure-com.mstools.apps.verisk.com/workflows/ba4f06a4bb9e447fa97020d0dd9a5aa5/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=j75YAyjbSkzTQ2iLA3ZU5H9rVDEMHpSH-2wSraNNDDc

Into:

https://prod--61-westus-logic-azure-com.mstools.apps.verisk.com/workflows/ba4f06a4bb9e447fa97020d0dd9a5aa5/triggers/manual/paths/invoke?api-version=2016-06-01&sp=/triggers/manual/run&sv=1.0&sig=j75YAyjbSkzTQ2iLA3ZU5H9rVDEMHpSH-2wSraNNDDc

If that doesn't resolve this, then I find that the use of the https://requestb.in/ website to be a helpful tool just to make sure that Jira can reach other sites when a webhook is triggered.  I am interested to see if you can try to use that site instead to test this out, then see what that site shows for the webhook received to learn more about this.  That site can help display other information about the request received.

Oh my gosh! Thank you @Andrew Heinzer!

 

This worked right off the bat!

Suggest an answer

Log in or Join to answer

Stay in touch

Be the first to know what's trending on Atlassian Community