Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Bug CCD 2.2.1 appears to break GetOrgAsync()

Discussion in 'Unity Cloud Content Delivery' started by PeachyPixels, Jan 26, 2023.

  1. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    662
    Hello!

    I just updated CCD from 2.1.0 to 2.2.1 (using Unity 2020.3.44f1) and the update appears to have broken the call to GetOrgAsync()

    I call this on service 'initialisation' (in dev builds) to list the organisation like so...

    Code (CSharp):
    1. CcdOrg organisation = await CcdManagement.Instance.GetOrgAsync();
    But the call blocks execution and neither times out (even if using the new CcdManagement.SetTimeout() method) or returns.

    I also call GetUserInfoAsync() like so...

    Code (CSharp):
    1. CcdUser user = await CcdManagement.Instance.GetUserInfoAsync();
    And this appears to work without issue.

    Rolling back to 2.1.0 fixes the issue, so it's definitely a change in 2.2.1
     
  2. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    662
    Ok, spent a few minutes debugging this and found the following in the WrappedCcdManagementService class...

    GetOrgAsync makes this call...

    Code (CSharp):
    1. var proj = (await TryCatchRequest(InternalGetOrgData, CcdManagement.projectid)).Result;
    Which in-turn calls InternalGetOrgData which fails on this call...

    Code (CSharp):
    1. var clientResponse = await _HttpClient.MakeRequestAsync(UnityWebRequest.kHttpVerbGET, url, null, headers, config.RequestTimeout.Value);
    Url = https://services.unity.com/api/unity/v1/projects/<ProjectId>
    Headers = [Authorization, Bearer <EncryptedString>]
    RequestTimeout = 10

    With an Http error (415)...

    "HTTP/1.1 415 Unsupported Media Type"

    The error is thrown then handled in TryCatchRequest here...

    Code (CSharp):
    1. catch (HttpException he)
    2. {
    3.   ResolveErrorWrapping((int)he.Response.StatusCode, he);
    4. }
    Then re-thrown here...

    Code (CSharp):
    1. //Other general exception message handling
    2. throw new CcdManagementException(code, exception.Message, exception);
    And is then unhandled.

    Further to that, Unity does not report this unhandled exception in the console as an error.
     
    Last edited: Jan 26, 2023
  3. llunity3d

    llunity3d

    Unity Technologies

    Joined:
    Aug 23, 2021
    Posts:
    24
    Hi @PeachyPixels

    Thank you for reporting this issue, a fix is on the way in the version 2.2.2 that should be release soon.
     
    PeachyPixels likes this.
  4. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    662
    So it looks like the header (generated in SetConfigurationAuthHeader) is different between the two versions.

    Not sure if this is the issue, but thought it worth reporting.

    The json access token generated looks identical between the two versions though.
     
  5. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    662
    Thanks for resolving so promptly :)

    Out of curiosity, was the issue as reported above or something else?
     
  6. llunity3d

    llunity3d

    Unity Technologies

    Joined:
    Aug 23, 2021
    Posts:
    24
    Yes the issue was like you pointed out

    Code (CSharp):
    1. var clientResponse = await _HttpClient.MakeRequestAsync(UnityWebRequest.kHttpVerbGET, url, null, headers, config.RequestTimeout.Value);
    MakeRequestAsync implementation changed to default to non multipart request which cause the issue with CCD.
     
    PeachyPixels likes this.
  7. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    662
    Hi @llunity3d

    Just installed 2.2.2 and can confirm that the fix works.

    Thanks for resolving this so promptly :)