Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-13388

Issue with api call on Bitbucket 8.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Medium Medium
    • None
    • 8.0.0, 8.1.0, 8.2.0, 8.0.1, 8.1.1, 8.0.2, 8.1.2, 8.2.1
    • API - REST

      Problem

      An exception happens when we use the endpoint

      rest/default-reviewers/1.0/projects/{projectKey}/repos/{repositorySlug}/reviewers

      on Bitbucket 8.0 or newer. It does work properly using Bitbucket 7.21 and older.

      Environment

      Bitbucket 8.0, 8.1, 8.2

      Steps to Reproduce

      Perform a call to endpoint,

      rest/default-reviewers/1.0/projects/{projectKey}/repos/{repositorySlug}/reviewers

       as following:

      http://<bitbucket>:7990/rest/default-reviewers/1.0/projects/{projectKey}/repos/{repositorySlug}/reviewers?sourceRepoId=sourceRepoId&targetRepoId=targetRepoId&sourceRefId=sourceRefId&targetRefId=targetRefId

      Expected Results

      http://ubuntu005:7990/rest/default-reviewers/1.0/projects/{projectKey}/repos/{repositorySlug}/reviewers?sourceRepoId=2&targetRepoId=2&sourceRefId=6b06eb0f9b8&targetRefId=b00c8d2d78f (200)
      cache-control: no-cache, no-transform
      connection: keep-alive
      content-encoding: gzip
      content-type: application/json
      date: Thu, 14 Jul 2022 00:02:01 GMT
      keep-alive: timeout=60
      transfer-encoding: chunked
      vary: x-ausername,x-auserid,cookie,accept-encoding
      x-arequestid: @BHLZU2x2x2706x0
      x-asessionid: 1k8ng6i
      x-auserid: 2
      x-ausername: Admin
      x-content-type-options: nosniff
      
      [
        {
          "name": "Reviewer",
          "emailAddress": "Reviewer@test.test",
          "id": 4,
          "displayName": "Reviewer",
          "active": true,
          "slug": "reviewer",
          "type": "NORMAL",
          "links": {
            "self": [
              {
                "href": "http://ubuntu005:7990/users/reviewer"
              }
            ]
          }
        }
      ]
      

      Actual Results

      http://centos001:7990/rest/default-reviewers/1.0/projects/{projectKey}/repos/{repositorySlug}/reviewers?sourceRepoId=2&targetRepoId=2&sourceRefId=6b06eb0f9b8&targetRefId=b00c8d2d78f (404)
      cache-control: no-cache, no-transform
      connection: keep-alive
      content-encoding: gzip
      content-type: application/json;charset=UTF-8
      date: Thu, 14 Jul 2022 00:38:15 GMT
      keep-alive: timeout=60
      transfer-encoding: chunked
      vary: x-ausername,x-auserid,cookie,accept-encoding
      x-arequestid: @1AXD1TJx1298x110x0
      x-asessionid: 100w2gg
      x-auserid: 52
      x-ausername: Admin
      x-content-type-options: nosniff
      
      {
        "errors": [
          {
            "context": null,
            "message": "Repository TES/pssrv-42288 doesn't have a b00c8d2d78f ref.",
            "exceptionName": "com.atlassian.bitbucket.repository.NoSuchBranchException"
          }
        ]
      }
      

      Workaround

      N/A

      Notes

      Error message from atlassian-bibtucket.log

      2022-07-13 21:38:15,141 DEBUG [http-nio-7990-exec-5] Admin @1AXD1TJx1298x110x0 100w2gg 192.168.0.176 "GET /rest/default-reviewers/1.0/projects/%7BprojectKey%7D/repos/%7BrepositorySlug%7D/reviewers HTTP/1.1" c.a.s.i.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 404
      com.atlassian.bitbucket.repository.NoSuchBranchException: Repository TES/pssrv-42288 doesn't have a b00c8d2d78f ref.
        at com.atlassian.bitbucket.internal.defaultreviewers.DefaultAutoReviewersService.getRef(DefaultAutoReviewersService.java:103)
        at com.atlassian.bitbucket.internal.defaultreviewers.DefaultAutoReviewersService.getReviewers(DefaultAutoReviewersService.java:68)
        at com.atlassian.bitbucket.internal.defaultreviewers.rest.DefaultReviewersRepositoryResource.getReviewers(DefaultReviewersRepositoryResource.java:119)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
        at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:75)
        at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:33)
        at com.atlassian.bitbucket.internal.xcode.web.XcodeUserAgentFilter.doFilter(XcodeUserAgentFilter.java:36)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.bitbucket.internal.ratelimit.servlet.filter.RateLimitFilter.doFilter(RateLimitFilter.java:75)
        at com.atlassian.plugin.connect.plugin.auth.scope.ApiScopingFilter.doFilter(ApiScopingFilter.java:81)
        at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.stash.internal.web.auth.AuthorizationFailureInterceptor.doFilterInternal(AuthorizationFailureInterceptor.java:39)
        at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:85)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:112)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)
        at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
        at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
        at com.atlassian.oauth2.provider.core.web.AccessTokenFilter.doFilter(AccessTokenFilter.java:81)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.plugin.connect.plugin.auth.oauth2.DefaultSalAuthenticationFilter.doFilter(DefaultSalAuthenticationFilter.java:69)
        at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109)
        at com.atlassian.plugins.authentication.basicauth.filter.DisableBasicAuthFilter.doFilter(DisableBasicAuthFilter.java:70)
        at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37)
        at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:26)
        at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:33)
        at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:90)
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73)
        at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:84)
        at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
        at java.lang.Thread.run(Thread.java:750)
        ... 273 frames trimmed
      2022-07-13 21:38:15,143 DEBUG [http-nio-7990-exec-5] Admin @1AXD1TJx1298x110x0 100w2gg 192.168.0.176 "GET /rest/default-reviewers/1.0/projects/%7BprojectKey%7D/repos/%7BrepositorySlug%7D/reviewers HTTP/1.1" c.a.s.i.s.g.m.RpcMetricsClientInterceptor Completed with 2 RPCs
      

              e74118b4e28d David Jansons
              4c9d8c819d67 Ulisses Azevedo
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: