Copied to clipboard

Flag this post as spam?

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


  • Angus Atkins-Trimnell 15 posts 85 karma points
    Jul 31, 2024 @ 20:28
    Angus Atkins-Trimnell
    0

    Models Builder: Run Custom Tool Suddenly Failing

    We are running an Umbraco site in v8.18.8. We have not had the time to upgrade to the new versions. We have been using Models Builder for the past 3 years. I have been able to run the Custom Tool when I make updates. Over the past two days I have been hitting an error, which pops up immediately.

    UmbracoModelsBuilder: Starting v8.0.5 7/31/2024 3:18:30 PM.
    UmbracoModelsBuilder: UmbracoModelsBuilder failed to generate code: Exception: Response status code does not indicate success (NotFound)
    
    UmbracoModelsBuilder:    at Umbraco.ModelsBuilder.Api.ApiClient.EnsureSuccess(HttpResponseMessage result)
       at Umbraco.ModelsBuilder.Api.ApiClient.ValidateClientVersion()
       at Umbraco.ModelsBuilder.CustomTool.CustomTool.UmbracoModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)
    

    I've checked to make sure the solution builds and that the Umbraco credentials I have are correct and the instance they point to is up and running.

    Is there any way to get more information about this error? I have a hard time imagining that it is to do with messed up document types because the error does return immediately.

    Thanks for any help.

    Angus

  • Angus Atkins-Trimnell 15 posts 85 karma points
    Jul 31, 2024 @ 21:17
    Angus Atkins-Trimnell
    0

    Decompiling the DLLs for Umbraco Models Builder, it seems the offending call is this:

    EnsureSuccess(client.PostAsync(_url + "/Umbraco/BackOffice/ModelsBuilder/ModelsBuilderApi/ValidateClientVersion", data, _formatter).Result);
    

    I tried hitting this in Postman by prepending my client URL to the string, and I did get a 404. I'm not entirely sure how meaningful this is. Of course, I didn't have the payload, but I did set my credentials in basic authentication, the way it seems to be done in the authentication line of the code.

    Is there a DLL that contains these backoffice methods that I could decompile and see if there is a problem?

    Thanks.

    Angus

  • Angus Atkins-Trimnell 15 posts 85 karma points
    Aug 07, 2024 @ 14:35
    Angus Atkins-Trimnell
    0

    Ok, so I found the Umbraco.ModelsBuilder.API.DLL on my Umbraco server, which seems to host the method being called.

    using System.Net;
    using System.Net.Http;
    using System.Net.Http.Formatting;
    using System.Web.Http;
    using Umbraco.Core;
    
    [HttpPost]
    [ApiBasicAuthFilter("settings")]
    public HttpResponseMessage ValidateClientVersion(ValidateClientVersionData data)
    {
        //IL_005d: Unknown result type (might be due to invalid IL or missing references)
        //IL_0062: Unknown result type (might be due to invalid IL or missing references)
        if (!Config.ApiServer)
        {
            return HttpRequestMessageExtensions.CreateResponse<string>(((ApiController)this).Request, HttpStatusCode.Forbidden, "API server does not want to talk to you.");
        }
        if (!((ApiController)this).ModelState.IsValid || data == null || !data.IsValid)
        {
            return HttpRequestMessageExtensions.CreateResponse<string>(((ApiController)this).Request, HttpStatusCode.BadRequest, "Invalid data.");
        }
        Attempt<HttpResponseMessage> val = CheckVersion(data.ClientVersion, data.MinServerVersionSupportingClient);
        if (!val.Success)
        {
            return val.Result;
        }
        return HttpRequestMessageExtensions.CreateResponse<string>(((ApiController)this).Request, HttpStatusCode.OK, "OK", (MediaTypeFormatter)(object)((ApiController)this).Configuration.Formatters.JsonFormatter);
    }
    

    I didn't see any error that could cause a NotFound error to be returned. When I looked in Application Insights, the call is indeed generating a 404 error:

    Name    POST /Umbraco/BackOffice/ModelsBuilder/ModelsBuilderApi/ValidateClientVersion   
    Response code   404 
    Successful request  false
    

    Does anyone know how this could happen, given that the DLL appears to be present. Could it be a hostname issue? We have several domains on this installation of Umbraco. However, that hasn't changed since our last successful run of the Models Builder custom tool.

    Any help or advice is greatly appreciated.

    Thanks.

    Angus

  • Angus Atkins-Trimnell 15 posts 85 karma points
    Oct 16, 2024 @ 15:43
    Angus Atkins-Trimnell
    0

    Can anyone give me guidance on this? I have updated my minor version to 8.18.14, but I am still getting the same error.

    This is becoming critical as I'm not able to create any new Document Types because my template won't be able to see the model.

Please Sign in or register to post replies

Write your reply to:

Draft