umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

ModelsBuilder API Errors #11756

Closed craigs100 closed 2 years ago

craigs100 commented 2 years ago

Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9

9.1.2

Bug summary

Site on shared hosting. Attempting to view Settings | Models Builder or Settings | Document Type (any) results in red error bars and console errors.

Specifics

Viewing Settings | Models Builder results in a red error bar stating:-

"Server error: Contact administrator, see log for full details. Failed to get dashboard"

And a browser console error of:- Screenshot from 2021-12-11 17-52-56

Attempting to view any Document Type for editing results in a red error bar stating:-

"Server error: Contact administrator, see log for full details. Failed to get models out-of-date status"

And a browser console error of:- Screenshot from 2021-12-11 17-56-56

The Health Checks for Permissions all pass.

As this relates to shared hosting, the fact that whatever the api is calling can't access "D:\HostingSpaces" gives me the impression the modelsbuilder api is referencing too many segments back in the path, i.e. above the web root.

Steps to reproduce

See "Specifics" and https://our.umbraco.com/forum/umbraco-9//107810-deployment-issues

Expected result / actual result

Expected to be able to view the Models Builder Dashboard to regenerate models and to be able to edit DocTypes.

Actual results was a blank Models Builder Dashboard. DocTypes changes cannot be saved.

bergmania commented 2 years ago

Hi @craigs100. Thanks for reporting. Did you change the configuration for where models are generated? Can you post your Modelsbuilder configuration :)

craigs100 commented 2 years ago

Hi @bergmania. Following Discord discussions, I may have been expecting something that wasn't even possible with V8. My solution has two projects, Site and Core. Models and Generated Models were configured to be in Core. Deploying the Site project to a local folder and then FTPing to the Web Server, the web site and back office ran fine apart from the errors editing DocTypes and opening the Settings - ModelsBuilder dashboard.

On advice and reflection, I have changed my live appsetting.json to put generated models in /Site/umbraco/models as the original /Core/ModelsGenerated didn't exist on the Web Server. This has fixed the errors but of course I now have to accept that I can't change DocTypes on the fly. They must be changed in Dev and uploaded via Dll and uSync.

I was going to explain this this morning but you got in before me ;)

Anyway, as you asked here are the relevant sections from my appsettings.json and appsettings.Development.json:- appsettings.json:-

      "ModelsBuilder": {
        "ModelsMode": "SourceCodeAuto",
        "ModelsNamespace": "Umbraco.Cms.Web.Common.PublishedModels",
        "AcceptUnsafeModelsDirectory": false,
        "ModelsDirectory": "~/umbraco/models"
      }

appsettings.Development.json:-

      "ModelsBuilder": {
        "ModelsMode": "SourceCodeAuto",
        "AcceptUnsafeModelsDirectory": true,
        "ModelsDirectory": "~/../Core/ModelsGenerated"
      }

Unless you have some advice or trick where we can edit DocTypes on the fly in this set up I suspect it's time to close this ticket :)

bergmania commented 2 years ago

Only ModelsMode: InMemoryAuto supports you can edit DocTypes on the fly, but in this setup you will not be able to precompile the views and thereby ensure no errors.