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()
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.
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.
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?)
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?
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.
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:
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 thewwwroot/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.
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
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 (asdotnet 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 nugetLooking 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.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 ?
I think its the build problem :
i just did
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.
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
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?
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.
The directory existed, I just needed to give my App Pool access to the nuget cache folder:
IIS AppPool\UmbracoSite
is working on a reply...