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
    Jun 21, 2022 @ 16:44
    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 2311 posts 14697 karma points MVP 7x c-trib
    Jun 22, 2022 @ 08:49
    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
    Jun 22, 2022 @ 09:13
    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 2311 posts 14697 karma points MVP 7x c-trib
    Jun 22, 2022 @ 10:10
    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 2311 posts 14697 karma points MVP 7x c-trib
    Jun 22, 2022 @ 10:12
    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
    Jun 23, 2022 @ 04:28
    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

  • Travis 19 posts 99 karma points
    Nov 01, 2022 @ 18:52
    Travis
    0

    This is interesting...I'm getting the same error on the latest version. However, I'm not running dotnetbuild or dotnetpublish, I have IIS setup to serve my site right from my c:\repos\umbracosite\umbracosite.web folder.

    I'm guessing I'll need to push the files to a different directory in my case?

  • Kevin Jump 2311 posts 14697 karma points MVP 7x c-trib
    Nov 01, 2022 @ 19:01
    Kevin Jump
    0

    Hi,

    this is because until you build the site certain files are served from the cache, when you run a dotnet publish, these files are copied into the published folder of a site so it can be distributed, but during development they come from the nuget cache.

    If you are running the site directly (without publishing first) on IIS then AspNet willl be looking for the uSync (and umbraco files) in the Nuget Cache

    in most cases this is in c:\users\USERNAME\.nuget\packages .

    I think it tries to get them from the folder of the user that installed the site (e.g you!) so I think you need to give the account running the site in IIS permissions to this folder inside your profile.

  • Travis 19 posts 99 karma points
    Nov 01, 2022 @ 18:58
    Travis
    0

    The directory existed, I just needed to give my App Pool access to the nuget cache folder:

    IIS AppPool\UmbracoSite

Please Sign in or register to post replies

Write your reply to:

Draft