Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-79091

Webhook invoked from post-function fails if the URL contains unsupported variables

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 10.0.0, 10.3.0, 10.3.8, 10.3.10, 11.0.0, 11.0.1
    • Webhooks
    • None

      Issue Summary

      As per the existing design, the only supported URL variables for the webhook invoked from post function are:

      1. project.id
      2. project.key
      3. issue.id
      4. issue.key

      In Jira 10.x, variable substitution no longer requires the $ token— only curly braces are needed, unlike in previous versions.

      However, an issue arises when a webhook is triggered from a workflow Postfunction, if, the webhook URL contains any substitution variable in curly braces other than mentioned above (for example,

      {comment.Id}

      ), the webhook fails with the error: "URISyntaxException: Illegal character in path at"

      Steps to Reproduce

      1. Created a Webhook like below that sends "Comment ID" to the connecting application as part of the URL parameter
       https://<Webhook URL>/comment={comment.id} 

      1. Add a Post Function to a status that calls the same Webhook on status change
      2. Now, when the Status is changed, the Webhook triggered fails with below Error
      2025-09-08 21:18:49,847+0530 ForkJoinPool.commonPool-worker-15 WARN      [c.a.w.internal.publish.DefaultWebhookDispatcher] Webhook invocation [d2f68254-46d4-4b4e-91ff-6568e6cf8e8c] to [https://xxx.com/hjqu20r/
      comment={comment.id}] failed with an error
      java.lang.IllegalArgumentException: Illegal character in path at index 66: https://xxx.com/hjqu20r/comment={comment.id}
              at java.base/java.net.URI.create(URI.java:906)
              at com.atlassian.webhooks.internal.client.request.RawRequest.hasQueryParams(RawRequest.java:149)
              at com.atlassian.webhooks.internal.client.request.RawRequest.buildAdditionalQueryParams(RawRequest.java:139)
              at com.atlassian.webhooks.internal.client.request.RawRequest.getUrl(RawRequest.java:108)
              at com.atlassian.webhooks.internal.client.request.DefaultRequestExecutor.execute(DefaultRequestExecutor.java:58)
              at com.atlassian.webhooks.internal.publish.DefaultWebhookDispatcher.dispatch(DefaultWebhookDispatcher.java:88)
              at com.atlassian.webhooks.internal.DefaultWebhookService.lambda$publish$9(DefaultWebhookService.java:309)
              at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
              at com.atlassian.webhooks.internal.DefaultWebhookService.lambda$publish$10(DefaultWebhookService.java:306)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
              at java.base/java.lang.Thread.run(Thread.java:842)
      Caused by: java.net.URISyntaxException: Illegal character in path at index 66: https://xxx.com/hjqu20r/comment={comment.id}
              at java.base/java.net.URI$Parser.fail(URI.java:2974)
              at java.base/java.net.URI$Parser.checkChars(URI.java:3145)
              at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3227)
              at java.base/java.net.URI$Parser.parse(URI.java:3175)
              at java.base/java.net.URI.<init>(URI.java:623)
              at java.base/java.net.URI.create(URI.java:904) 

      Note- This setup works fine with Jira 9.12.x where if there's no supported variable to replace it with, we put nothing in its place . 

      Expected Results

      Webhook should be invoked without error via Post Function and any unmatched variable should be omitted from the URL.

      Actual Results

      Webhook is not invoked via Post Function and fails with "Illegal character in path at index ..." Error 

      Workaround

      Create a separate Webhook that are to be invoked via Post Function and ensure that only the following supported substitution variables are used in the webhook URL:.

      1. project.id
      2. project.key
      3. issue.id
      4. issue.key

              Unassigned Unassigned
              ff40f4e86f48 Karan Ahuja
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: