An error message "User Lookup Failed" appears on integrating Xcode with Bitbucket Data Center

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Data Center のみ - この記事は、Data Center プラットフォームのアトラシアン製品にのみ適用されます。

この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

要約:

While adding a Bitbucket server account in Xcode, an error message "User Lookup Failed" pops up.

Environment:

  • Bitbucket Data Center - 8.9.7
  • Xcode - 15

Diagnosis:

  •  The atlassian-bitbucket.log will have the following error stack trace:

    2024-01-23 11:01:44,357 DEBUG [http-nio-7990-exec-5 url: /rest/api/1.0/application-properties] @IH7EH9x661x117x0 10.211.XX.X "GET /rest/api/1.0/application-properties HTTP/1.1" c.a.b.i.c.s.CrowdSsoAuthenticationHandler Skipping Crowd SSO as it is not enabled
    2024-01-23 11:01:44,357 DEBUG [http-nio-7990-exec-5 url: /rest/api/1.0/application-properties] @IH7EH9x661x117x0 10.211.XX.X "GET /rest/api/1.0/application-properties HTTP/1.1" c.a.s.i.a.DefaultAuthenticationService user1@example.com: Authenticator 'com.atlassian.bitbucket.server.bitbucket-crowd-sso:crowdSsoAuthHandler' opted out
    2024-01-23 11:01:44,357 DEBUG [http-nio-7990-exec-5 url: /rest/api/1.0/application-properties] @IH7EH9x661x117x0 10.211.XX.X "GET /rest/api/1.0/application-properties HTTP/1.1" c.a.s.i.a.DefaultAuthenticationService user1@example.com: Authenticator 'com.atlassian.bitbucket.server.bitbucket-git-lfs:git-lfs-jwt-auth-handler' opted out
    2024-01-23 11:01:44,401 DEBUG [http-nio-7990-exec-5 url: /rest/api/1.0/application-properties] @IH7EH9x661x117x0 10.211.XX.X "GET /rest/api/1.0/application-properties HTTP/1.1" c.a.s.i.user.DefaultUserService user1@example.com: User is active; updating cache
    2024-01-23 11:01:44,406 DEBUG [http-nio-7990-exec-5 url: /rest/api/1.0/application-properties] @IH7EH9x661x117x0 10.211.XX.X "GET /rest/api/1.0/application-properties HTTP/1.1" c.a.s.i.a.DefaultAuthenticationService user1@example.com: Authenticator 'com.atlassian.bitbucket.server.bitbucket-access-tokens:accessTokenHttpAuthHandler' authenticated user1@example.com (3)
    2024-01-23 11:01:44,437 DEBUG [http-nio-7990-exec-4 url: /rest/api/1.0/users/user1@example.com] @IH7EH9x661x118x0 10.211.XX.X "GET /rest/api/1.0/users/user1@example.com HTTP/1.1" c.a.b.i.c.s.CrowdSsoAuthenticationHandler Skipping Crowd SSO as it is not enabled
    2024-01-23 11:01:44,437 DEBUG [http-nio-7990-exec-4 url: /rest/api/1.0/users/user1@example.com] @IH7EH9x661x118x0 10.211.XX.X "GET /rest/api/1.0/users/user1@example.com HTTP/1.1" c.a.s.i.a.DefaultAuthenticationService user1@example.com: Authenticator 'com.atlassian.bitbucket.server.bitbucket-crowd-sso:crowdSsoAuthHandler' opted out
    2024-01-23 11:01:44,437 DEBUG [http-nio-7990-exec-4 url: /rest/api/1.0/users/user1@example.com] @IH7EH9x661x118x0 10.211.XX.X "GET /rest/api/1.0/users/user1@example.com HTTP/1.1" c.a.s.i.a.DefaultAuthenticationService user1@example.com: Authenticator 'com.atlassian.bitbucket.server.bitbucket-git-lfs:git-lfs-jwt-auth-handler' opted out
    2024-01-23 11:01:44,452 DEBUG [http-nio-7990-exec-4 url: /rest/api/1.0/users/user1@example.com] @IH7EH9x661x118x0 10.211.XX.X "GET /rest/api/1.0/users/user1@example.com HTTP/1.1" c.a.s.i.user.DefaultUserService user1@example.com: Returning active from cache
    2024-01-23 11:01:44,453 DEBUG [http-nio-7990-exec-4 url: /rest/api/1.0/users/user1@example.com] @IH7EH9x661x118x0 10.211.XX.X "GET /rest/api/1.0/users/user1@example.com HTTP/1.1" c.a.s.i.a.DefaultAuthenticationService user1@example.com: Authenticator 'com.atlassian.bitbucket.server.bitbucket-access-tokens:accessTokenHttpAuthHandler' authenticated user1@example.com (3)
    2024-01-23 11:01:44,471 DEBUG [http-nio-7990-exec-4 url: /rest/api/1.0/users/user1@example.com; user: user1@example.com] user1@example.com @IH7EH9x661x118x0 10.211.XX.X "GET /rest/api/1.0/users/user1@example.com HTTP/1.1" c.a.s.i.r.e.ServiceExceptionMapper Mapping NoSuchUserException to REST response 404 - User user1@example.com does not exist.
  • An error "User lookup Failed" will appear on the Xcode tool.

原因:

  • When a user adds a Bitbucket account, Xcode performs a user look-up using the "/rest/api/1.0/users/<user-name>" API, using the same username that the user entered in the login form. This API accepts a slug as input instead of a username, although if the username is simple and has no special characters, using a username in the API doesn't cause any issues because the username and slug could be identical in this scenario.
  • The issue arises when a username contains special characters since the username and slug are likely to differ in this scenario.  When a user is created in Bitbucket, the username is converted to a unique slug value and both may differ.
  • In Bitbucket, user retrieval is done via the /rest/api/latest/users/{userSlug} API endpoint, where user slug is the only parameter used and is described in the API Doc. 
  • In this particular case, the username is the user1@example.com email address, which has the "@" sign. Thus, when this username was first created in Bitbucket, the "@" sign was changed to the "_" symbol to obtain the real slug value, which was then saved in the database.
  • In this scenario, the true slug is user1_example.com, but Xcode does not transform the username into a slug before sending it to Bitbucket, thus the user lookup is performed using the username, user1@example.com. Because there is no user with the slug user1@example.com, Bitbucket sends Xcode a 404 HTTP response, which causes "User Lookup Failed" to show in Xcode.
  • The user details and distinction between username and slug are displayed in the manual execution of the same API that follows.

    curl -s -u user1@example.com:<Token> http://10.211.XX.X:7990/rest/api/1.0/users/user1_example.com |jq "."
    {
      "name": "user1@example.com",
      "emailAddress": "user1@example.com",
      "active": true,
      "displayName": "user1@example.com",
      "id": 3,
      "slug": "user1_example.com",
      "type": "NORMAL",
      "links": {
        "self": [
          {
            "href": "http://10.211.XX.X:7990/users/user1_example.com"
          }
        ]
      }
    }

ソリューション

  • The API used in Xcode to retrieve the user is not correct thus seek help from the product vendor of the Xcode tool to find a way to add the Bitbucket account in Xcode if the username and slug differ.



最終更新日: 2024 年 2 月 16 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.