Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Noor Drummond 10 posts 82 karma points
    3 days ago
    Noor Drummond
    0

    uSync v10 crashing Umbraco 10 during startup

    Hi,

    We are using uSync.Complete and recently upgraded from v9 to v10, alongside the Umbraco v10 upgrade. After this change Umbraco (deployed to Azure as a Docker image running on Linux, if relevant) is crashing during startup and is complaining about someone missing files under usync.expansions.core.

    Has anyone come across this issue or know what it might be?

    Thanks in advance.

    Stack trace:

    2022-06-21T16:35:34.687394702Z Unhandled exception. System.IO.DirectoryNotFoundException: /root/.nuget/packages/usync.expansions.core/10.0.0/staticwebassets/
    2022-06-21T16:35:34.687426202Z    at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
    2022-06-21T16:35:34.687431702Z    at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root)
    2022-06-21T16:35:34.687434902Z    at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__1_0(String contentRoot)
    2022-06-21T16:35:34.687438802Z    at Microsoft.AspNetCore.StaticWebAssets.ManifestStaticWebAssetFileProvider..ctor(StaticWebAssetManifest manifest, Func`2 fileProviderFactory)
    2022-06-21T16:35:34.687442002Z    at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest)
    2022-06-21T16:35:34.687445202Z    at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration)
    2022-06-21T16:35:34.687448402Z    at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c.<UseStaticWebAssets>b__10_0(WebHostBuilderContext context, IConfigurationBuilder configBuilder)
    2022-06-21T16:35:34.687451802Z    at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder    .<>c__DisplayClass9_0.<ConfigureAppConfiguration>b__0(HostBuilderContext context, IConfigurationBuilder builder)
    2022-06-21T16:35:34.687461102Z    at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
    2022-06-21T16:35:34.687464602Z    at Microsoft.Extensions.Hosting.HostBuilder.Build()
    2022-06-21T16:35:34.687467602Z    at Umbraco.Cms.Web.Common.Hosting.UmbracoHostBuilderDecorator.Build()
    
  • Kevin Jump 2129 posts 13459 karma points MVP 6x c-trib
    3 days ago
    Kevin Jump
    0

    Hi Noor.

    How are the files deployed into the docke image ?

    it looks like the site is looking for files from the nuget cache, but if you deploy a site using Dotnet Publish then the resultant publish folder should have those files into the wwwroot/app_plugins/uSync... folder - and all the static web asset stuff doesn't happen.

    When you are in dev mode the files should come from the nuget path, but the server running the site will need access to the nuget cache folder - during local dev this is usually you account (because you are running dotnet run) or IIS but in a docker image i am not sure.

  • Noor Drummond 10 posts 82 karma points
    3 days ago
    Noor Drummond
    0

    Hi Kevin,

    Thanks for replying.

    The files are deployed using dotnet publish, the Dockerfile we use to build is here.

    We followed the version 9 -> 10 upgrade guide which says to insert a call to webBuilder.UseStaticWebAssets(), so not sure if that is causing the problem.

    What is even weirder is when running locally don't get startup errors but there seems to still be an issue loading some assets as when running uSync reports for example get the screen shown below and console errors indicating missing files.

    Seems like something has changed in the way static assets are included so probably need to research that further and investigate unless anyone has any pointers what the issue could be.

    Thanks.

    Noor

    screenshot

  • Kevin Jump 2129 posts 13459 karma points MVP 6x c-trib
    3 days ago
    Kevin Jump
    0

    Hi,

    If you have upgraded from v9 I would make sure you have deleted any uSync files from the app_plugins folder in your solution, the files don;t live there anymore and that might be causing an issue in dev (as dotnet clean will also do this for you)

    I did some limited dotnet publish tests, and cleaned out my nuget cache so it was empty and it still works for me, because the files are being pulled in from wwwroot/app_plugins not nuget


    Looking in the aspnet core code, when you have UseStaticWebAssets i think it looks for a assembly.staticassets.runtime.json file in the same place as the site dll.

    • In development (so dotnet run) there is one of these in the bin folder
    • but when i dotnet publish a site there isn't one (which is what you would expect)

    so might be worth checking if something like that is being generated (is left hanging over from something else) for you site ?


    I am not up on docker stuff, but i think . you build the app into the same folder you them publish it to. So maybe the dotnet build files are still there and interfering with the build.

    might be worth :

    A) not building (you don't need to if you publish?)

    B) publishing into a different folder ?

  • Kevin Jump 2129 posts 13459 karma points MVP 6x c-trib
    3 days ago
    Kevin Jump
    100

    I think its the build problem :

    i just did

    • dotnet build -o ..\published
    • dotnet publish -o ..\published
    • dotnet nuget locals -c all (cleans the nuget folder)

    ran the site and got the error

    its because the resulting folder has both build and publish files in it.

    so your publish folder needs to be different from your build one.

  • Noor Drummond 10 posts 82 karma points
    1 day ago
    Noor Drummond
    0

    Hi Kevin,

    Thanks for the detailed reply. Those suggestions worked great.

    Got things working locally by manually deleting uSync from App_Plugins (for some reason dotnet clean didn't remove these).

    Modifying the Dockerfile to publish into a different directory than the build got rid of the startup error in Azure.

    Thanks again.

    Regards,

    Noor

Please Sign in or register to post replies

Write your reply to:

Draft