Search Unity

Bug CcdManagement API only available in the editor?

Discussion in 'Unity Cloud Content Delivery' started by PeachyPixels, Dec 9, 2022.

  1. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Hello!

    I'm trying to build a project that contains CCD (but no Addressables) in UCB, but the builds keep failing with the following error (when building for Android, haven't tested iOS yet)...

    error CS0234: The type or namespace name 'Ccd' does not exist in the namespace 'Unity.Services' (are you missing an assembly reference?)

    The cs file that is triggering the error has the following two using clauses...

    Code (CSharp):
    1. using Unity.Services.Ccd.Management;
    2. using Unity.Services.Ccd.Management.Models;
    CCD 2.1.0 was installed as per the Unity instructions (for using it without Addressables) and it works fine in the player.

    Any help would be much appreciated.
     
    Last edited: Apr 11, 2023
  2. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Is anyone from Unity able to help with this please?
     
  3. Unity_JonathanCl

    Unity_JonathanCl

    Unity Technologies

    Joined:
    Feb 24, 2022
    Posts:
    15
    Hi PeachyPixels,

    It looks like there are referenced assemblies that cannot be resolved. Can you validate that you have the unity services core package installed and what is the version that is installed?

    Regards,
    JC
     
  4. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Hi @Unity_JonathanCl

    Thanks for the response.

    So packages-lock.json includes these two entries...

    "com.unity.services.ccd.management": {
    "version": "2.1.0",
    "depth": 0,
    "source": "registry",
    "dependencies": {
    "com.unity.services.core": "1.3.1",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.nuget.newtonsoft-json": "3.0.2"
    },
    "url": "https://packages.unity.com"
    },
    "com.unity.services.core": {
    "version": "1.7.0",
    "depth": 1,
    "source": "registry",
    "dependencies": {
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.nuget.newtonsoft-json": "3.0.2",
    "com.unity.modules.androidjni": "1.0.0"
    },
    "url": "https://packages.unity.com"
    },

    But manifest.json only contains one of the above...

    "com.unity.services.ccd.management": "2.1.0",

    And finally the com.unity.services.core@1.7.0 folder exists in the package cache, but not 1.3.1

    So I wonder if the missing Core 1.3.1 package is causing this?

    I've just uninstalled\reinstalled the CCD package (using Package Manager) but it still hasn't updated. By that I mean adding the Core 1.3.1 entry to manifest.json or adding Core 1.3.1 into the package cache.
     
  5. Unity_JonathanCl

    Unity_JonathanCl

    Unity Technologies

    Joined:
    Feb 24, 2022
    Posts:
    15
    Could you try to add the Core 1.3.1 package to see if it solves the issue?
     
  6. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    I've tried but can't seem to find a way to install a dependant (only) package.

    Re-installing the parent (CCD) package doesn't appear to install dependant packages (well certainly if ones with higher versions exists). Dependant only packages (i.e. com.unity.services.core) aren't listed in the package manager. And manually adding the package to the manifest doesn't install the package or fix the issue either.

    So I guess the question is, how can you install dependant only packages?
     
  7. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Update #1: I've tried deleting the lock file, but it still doesn't install the Core 1.3.1 package when the project is opened (and the lock file re-created)

    Looking at the dependencies in the package manager, Unity seems happy using Core 1.7.0 with CCD 2.1.0 (see attached screenshot)

    So maybe the issue is UCB and not CCD or Editor package management?
     

    Attached Files:

    Last edited: Dec 14, 2022
  8. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Update #2: Just realised that enabling show dependencies also seems to show the Core packages in the package manager now. Great!

    But if I downgrade to Core 1.3.1 this will break the project (I suspect) as Unity Authentication requires Core 1.7.0 (hence why it's installed)

    "com.unity.services.authentication": {
    "version": "2.4.0",
    "depth": 0,
    "source": "registry",
    "dependencies": {
    "com.unity.nuget.newtonsoft-json": "3.0.2",
    "com.unity.services.core": "1.7.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.ugui": "1.0.0"
    },
    "url": "https://packages.unity.com"
    },

    So I suspect this is a UCB issue.
     
  9. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Would someone from Unity be kind enough to move this to the UCB forum please?
     
  10. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Is anyone from Unity able to help please?
     
  11. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    303
    The best way to get support on this issue would be to open up a support ticket with the cloud build customer service team. In the Unity Dashboard go to DevOps -> Help & Support -> File a Ticket.
     
  12. Recky256

    Recky256

    Joined:
    Dec 1, 2014
    Posts:
    11
    Same issue. I opened up a support ticket but support team doesn't help me.
    Can anyone give me a example project that can build? Even CCD sample(include package) can't build.
     
  13. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    I moved onto something else but am back on the build process now.

    Before logging this as a call...

    1. I just upgraded from 2020.LTS to 2021.LTS and the same issue\error.

    2. After inspecting the full build log, I noticed the following entries...
    Code (CSharp):
    1. [2023-04-03T10:35:00Z - Unity]     com.unity.services.ccd.management@2.2.2 (location: BUILD_PATH/p\Library\PackageCache\com.unity.services.ccd.management@2.2.2)
    2. [error] [2023-04-03T10:35:16Z - Unity] Start importing Packages/com.unity.services.ccd.management/Editor/ErrorMitigation using Guid(d8e999ad503bbcc468c6b62880bf92d1) Importer(-1,00000000000000000000000000000000)  -> (artifact id: '3fc4496962e5025dd34a8766d7ccde5e') in 0.000691 seconds
    3. [error] [2023-04-03T10:35:24Z - Unity] Start importing Packages/com.unity.services.ccd.management/Editor/ErrorMitigation/RetryPolicy.cs using Guid(2180ce0c55ae1bf498167e2063e8fd11) Importer(-1,00000000000000000000000000000000)
    4. [error] [2023-04-03T10:35:41Z - Unity] Start importing Packages/com.unity.services.ccd.management/Editor/ErrorMitigation/RetryPolicyConfig.cs using Guid(58826ab4ee33ae3469b90bc6d4588a93) Importer(-1,00000000000000000000000000000000)  -> (artifact id: '49fea74796739968fb3894db4bbcd14e') in 0.002140 seconds
    5. [error] [2023-04-03T10:35:42Z - Unity] Start importing Packages/com.unity.services.ccd.management/Editor/ErrorMitigation/IRetryPolicy.cs using Guid(3aa6aa8b0c8265f47b75d3d6a963c038) Importer(-1,00000000000000000000000000000000)  -> (artifact id: 'bf62de6915036261a8773720049b8630') in 0.001828 seconds
    6. [error] [2023-04-03T10:35:43Z - Unity] Start importing Packages/com.unity.services.ccd.management/Editor/ErrorMitigation/StatusCodePolicyConfig.cs using Guid(bc9a6834516bb384aaebcb022b3e0047) Importer(-1,00000000000000000000000000000000)  -> (artifact id: 'fab554167627f27acba79ea201e499a1') in 0.001577 seconds
    Maybe this could shed some light on the issue?

    All other CCD entries in the log appeared to be ok, including the list of Unity packages to build...
    Code (CSharp):
    1. [2023-04-03T10:35:00Z - Unity]   Packages from [https://packages.unity.com]:
    2. [2023-04-03T10:35:00Z - Unity]     com.unity.ide.visualstudio@2.0.17 (location: BUILD_PATH/p\Library\PackageCache\com.unity.ide.visualstudio@2.0.17)
    3. [2023-04-03T10:35:00Z - Unity]     com.unity.purchasing@4.7.0 (location: BUILD_PATH/p\Library\PackageCache\com.unity.purchasing@4.7.0)
    4. [2023-04-03T10:35:00Z - Unity]     com.unity.remote-config@3.3.1 (location: BUILD_PATH/p\Library\PackageCache\com.unity.remote-config@3.3.1)
    5. [2023-04-03T10:35:00Z - Unity]     com.unity.services.authentication@2.4.0 (location: BUILD_PATH/p\Library\PackageCache\com.unity.services.authentication@2.4.0)
    6. [2023-04-03T10:35:00Z - Unity]     com.unity.services.ccd.management@2.2.2 (location: BUILD_PATH/p\Library\PackageCache\com.unity.services.ccd.management@2.2.2)
    7. [2023-04-03T10:35:00Z - Unity]     com.unity.textmeshpro@3.0.6 (location: BUILD_PATH/p\Library\PackageCache\com.unity.textmeshpro@3.0.6)
    8. [2023-04-03T10:35:00Z - Unity]     com.unity.timeline@1.8.2 (location: BUILD_PATH/p\Library\PackageCache\com.unity.timeline@1.8.2)
    9. [2023-04-03T10:35:00Z - Unity]     com.unity.services.core@1.8.1 (location: BUILD_PATH/p\Library\PackageCache\com.unity.services.core@1.8.1)
    10. [2023-04-03T10:35:00Z - Unity]     com.unity.nuget.newtonsoft-json@3.0.2 (location: BUILD_PATH/p\Library\PackageCache\com.unity.nuget.newtonsoft-json@3.0.2)
    11. [2023-04-03T10:35:00Z - Unity]     com.unity.remote-config-runtime@3.1.3 (location: BUILD_PATH/p\Library\PackageCache\com.unity.remote-config-runtime@3.1.3)
    12. [2023-04-03T10:35:00Z - Unity]     com.unity.test-framework@1.1.31 (location: BUILD_PATH/p\Library\PackageCache\com.unity.test-framework@1.1.31)
    13. [2023-04-03T10:35:00Z - Unity]     com.unity.ext.nunit@1.0.6 (location: BUILD_PATH/p\Library\PackageCache\com.unity.ext.nunit@1.0.6)
    @benjamingooding @Unity_JonathanCl any ideas please?
     
  14. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    303
    It looks like that [error] tag in front should not be in the logs for those import statements. My guess is that our log processing sees the ErrorMitigation and thinks that there was an error when in reality there wasn't.

    So that shouldn't be the reason that you are getting issues with CCD.
     
  15. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Hi @benjamingooding

    Yes I've logged this as an issue and currently working through it with one of your support agents.

    After another day of experimenting with the Android build, I've whittled it down to the following...

    1. Comment out all CCD code\calls and the build is successful (clean builds, locally & UCB)
    2. Un-comment all CCD code\calls and the build fails with the CCD namespace resolve error (clean builds, locally & UCB)

    Even with successful builds though, some of the aforementioned errors still appear in the log file.

    So it's definitely looking like a CCD build issue. But it looks like whatever is causing the actual failure is not being reported in the log files.
     
  16. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Can't believe I didn't notice this before, but...

    The CcdManagement class exists inside an Editor folder, which would explain why this is only working in the editor and failing in builds.

    Which begs the questions...

    1. Was CcdManagement only intended for editor use?
    2. If so why (and what should actually be used at runtime)?
     
    Last edited: Apr 11, 2023
  17. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Given that I can now replicate this issue with a local build, I think it's safe to say this rules out UCB.

    So would someone from Unity be kind enough to move this to the CCD forum please?
     
  18. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    303
    I moved the thread to CCD for you.
     
    PeachyPixels likes this.
  19. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
  20. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hey David,
    Thanks for posting and asking great questions.

    You are right the CcdManagement seems to only intended for editor use. However we have a ticket open ticket to resolve the error in question that you got at build time.

    I had an internal discussion regarding this and it seems what you are looking for may be the CCD client
    My only problem with this suggestion is our documentation is limited to this.

    Additionally it is difficult to find the package you would need to add the following package by name
    com.unity.services.ccd-client
    in the package manager

    Alternatively would using the API / CLI be something that can be used in your application?
     
    PeachyPixels likes this.
  21. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Thanks @SebT_Unity

    I never spotted the client SDK docs when I setup CCD originally. Not sure if that was my issue or not. That said, typing CCD into the Package Manager with 2020.LTS only returned the Management SDK, not the Client. I just tried this on 2021.LTS and it shows both.

    So I've removed the management SDK, installed the client SDK and swapped the CCD calls to their respective client alternatives.

    However, they're both returning HTTP/404's ("bucket not found for current environment")

    I've a private bucket (with an access token) setup in a dev environment. Unity Services are initialised and the bucket & entry id's are obviously the same.

    I suspect it's because the access token is required (where-as the management SDK doesn't appear to require it) but the client SDK has no way to specify it.

    The documentation states...

    "For buckets configured as private, everything in the Client API requires a Bucket Access Token that is specific that particular bucket"

    So where do you specify the access token in the client SDK?
     
    Last edited: Apr 13, 2023
    SebT_Unity likes this.
  22. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi David,

    Indeed you have found a shortcoming with the CCD client.
    I have advised the team and specific tickets have been put in place for follow-up by the developers.

    If you have a moment could you describe your Scenario so I could append it to both the CCD Client and CCD Management tickets?

    You may be forced to use the API using unity web requests within your project at this point.

    I would love to hear your thoughts on that solution so I can append the feedback to the active tickets.
     
  23. TruJordan

    TruJordan

    Joined:
    Dec 13, 2022
    Posts:
    4
    On a similar note I would love to know how to specify the access token (for a private bucket) in the CcdManagement SDK as well.
     
  24. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Thanks for the update. I would imagine most projects using private buckets, so hopefully this can be categorised as fairly urgent.

    I can't justify the time it'll take to go down that route at present. I've reverted to CCDManagement for player builds and bundled custom packages (as resources) for dev device builds. So for the time being, I've managed to work around the issue.

    Of course, I see three issues...

    1) CCDManagement is only available in the editor, due to the scripts being stored in an Editor folder.

    2) CCDManagement does not seem to require an access token, which is worrying. Either there is some other behind the scenes authentication going on (using the Unity account?) or private buckets aren't as private as they should be.

    3) CCDClient has no way of specifying an access token, meaning it will not work with private buckets. Maybe all the xArgs classes should include the access token as well?

    A few other observations\suggestions (nice to have, not show stoppers)...

    4) Are two packages really needed? Why not merge both into one? If not, why not have CCDManagement offering upload\write functionality only and CCDClient offering download\read functionality only (as currently there is a fair amount of duplication)

    5) There are some discrepancies with matching calls in both packages. For example CCDManagement.GetEntryAsync requires the bucket & entry id's whilst CCDClient.GetEntryAsync requires EntryArgs

    Hope this helps.
     
    Last edited: Apr 17, 2023
    SebT_Unity likes this.
  25. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    CCDManagement doesn't currently require an access token (see point 2 above) and works without one (even on private buckets)

    Hopefully Unity is using some other form of behind the scenes authentication, rather than buckets not being as private as they should be.
     
  26. TruJordan

    TruJordan

    Joined:
    Dec 13, 2022
    Posts:
    4
    If you're correct that is very concerning. My latest experience, though, was that I was receiving HTTP errors whenever trying to use the CcdManagement SDK (version 2.2.2) with private buckets. Switching to public buckets (although still promotion-only) resolved the errors for me. Perhaps my issue is unrelated.
     
  27. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    I am seeing different behaviour here. I have a private bucket defined (with an access token) and CCDManagement works (as expected) without any errors\issues.

    It might be that Unity have a second behind the scenes authentication process (the Unity account maybe) and that's why it was working.

    Either way, not ideal and hopefully they can clarify and\or address this if need be.
     
  28. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Hi @SebT_Unity

    Any idea on a timescale with this fix please? Hopefully sooner rather than later as it's rather an important one imo.

    Are Unity also considering releasing this change as a preview package? That would mean those utilising private buckets can actually test\use the client API.
     
    Last edited: May 11, 2023
    SebT_Unity likes this.
  29. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
  30. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi David,
    Apologies for the delayed response I had seen your ping the other week and brought this forward to the CCD team,
    I don't have a time scale on the modification. I will bring this forward again today.

    Guidance is still to use the RESTAPI at the time being.
     
  31. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    Thanks @SebT_Unity

    If you could it would be appreciated. Using one of CCD's core security features renders the client API unusable, so it's quite a fundamental issue imho.

    I would be more than happy to test the fix, if it helps accelerate progress.