PullRequestDetectionBackgroundThread fails to authenticate when polling Bitbucket DC

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Medium
    • None
    • Affects Version/s: 12.1.8
    • Component/s: Bitbucket integration
    • None
    • 1
    • Severity 2 - Major

      Issue Summary

      The PullRequestDetectionBackgroundThread polling fallback mechanism fails to authenticate when polling Bitbucket Data Center for pull request changes. The primary webhook/event-driven path authenticates correctly with the same application link configuration.

      Steps to Reproduce

      1. Set up Bamboo 12.1.8 with a linked Bitbucket Data Center (v9.4.8) repository using OAuth + impersonation (2-legged OAuth RSA-SHA1)
      2. Confirm the primary integration path works (webhooks, push events, PR triggers all authenticate successfully)
      3. Force the polling fallback mechanism by adding the JVM argument:
        • -Dbamboo.stash.enforce.pullrequest.polling.only=true
      4. Observe the PullRequestDetectionBackgroundThread attempting to poll Bitbucket's REST API for PR changes

      Expected Results

      The BitbucketServerPullRequestDetector polling path authenticates successfully against Bitbucket DC using the configured OAuth application link and returns pull request data.

      Actual Results

      The below exception is thrown in the atlassian-bamboo.log file:
       
       

      2026-06-18 20:16:42,525 INFO [20-PullRequestDetectionBackgroundThread:pool-21-thread-1] [BitbucketServerPullRequestDetector] Fetch list of Bitbucket Stash PRs [repositoryId: 622594] 
      2026-06-18 20:16:42,559 WARN [20-PullRequestDetectionBackgroundThread:pool-21-thread-1] [RestCallHelper] Failed to execute application link request. Server: https://linux-{REDACTED]/bitbucket Method: GET Url: /rest/api/1.0/projects/TEST/repos/test/pull-requests?direction=INCOMING&state=OPEN&order=NEWEST&start=0&limit=25 Response: 401 Unauthorized Errors: {"message":"You are not permitted to access this resource","exceptionName":"com.atlassian.plugins.rest.api.security.exception.AuthenticationRequiredException"}

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

              Assignee:
              Unassigned
              Reporter:
              AP
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: