Copied to clipboard

Flag this post as spam?

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


  • Ryan Hoang 2 posts 82 karma points
    May 31, 2021 @ 08:56
    Ryan Hoang
    0

    Received an error from the server when in Info tab in Content

    I'm working on an 7.15.0 Umbraco site and for some Content, whenever I click on the Info, I got an error like this: enter image description here

    Here is the stacktrace: at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Umbraco.Web.Editors.LogController.MapAvatarsAndNames(IEnumerable1 items) at Umbraco.Web.Editors.LogController.GetPagedEntityLog(Int32 id, Int32 pageNumber, Int32 pageSize, Direction orderDirection, Nullable1 sinceDate) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.

    I open devtool to check the console and got this: Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://localhost:63417/umbraco/backoffice/UmbracoApi/Log/GetPagedEntityLog?pageSize=10&pageNumber=1&orderDirection=Descending&id=9589

    I'm really confused because the content sites are similar but only some got this error.

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    May 31, 2021 @ 14:36
    Marc Goodson
    0

    Hi Ryan

    Looks like a problem on the Info tab, as here for a content item, the audit history of activities for the page is displayed, eg 'saved' 'published' etc

    If you notice on a page that's working ok, each audit entry has a little avatar next to it for the person who performed the action.

    The error your seeing is being thrown in 'MapAvatarsAndNames'...

    https://github.com/umbraco/Umbraco-CMS/blob/v7/dev/src/Umbraco.Web/Editors/LogController.cs#L86

    So I reckon there is a user in your backoffice who has interacted with the page in the past, and either has been deleted or somehow has a mucked up avatar..

    does that sound possible?

    regards

    Marc

    .

  • Ryan Hoang 2 posts 82 karma points
    Jun 03, 2021 @ 13:50
    Ryan Hoang
    0

    Hi Marc,

    I think that's possible. I check the users tab and see some users are disabled. I enabled them but the error is still there. The avatars are default (just initials for their names) so I think maybe some users are deleted and cause the error? If so is there a way to fix the error or maybe just show the audit history from other users?

    Thank you!

  • shekhar sharma 22 posts 110 karma points
    May 31, 2021 @ 15:19
    shekhar sharma
    0

    Hi Ryan, please check the document type or User Name, it seems document-Type/ User Name for that particular node is deleted... Or can you update the log file here...??

    Thanks, Shekhar

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jun 05, 2021 @ 07:20
    Marc Goodson
    100

    Hi Ryan

    One way to debug this is to try and see which Users have interacted with this content item (and so are 'in the audit log'). You could do this via SQL, or also in code.

    If you look at the implementation of GetPagedEntityLog where the error is occurring:

    https://github.com/umbraco/Umbraco-CMS/blob/d428a4543f33bb7094cf7db5f6b6fdc2d1de3063/src/Umbraco.Web/Editors/LogController.cs#L33

    You can see the lines that retrieves the audit information:

     long totalRecords;
            var dateQuery = sinceDate.HasValue ? SqlContext.Query<IAuditItem>().Where(x => x.CreateDate >= sinceDate) : null;
            var result = Services.AuditService.GetPagedItemsByEntity(id, pageNumber - 1, pageSize, out totalRecords, orderDirection, customFilter: dateQuery);
            var mapped = result.Select(item => Mapper.Map<AuditLog>(item));
    

    You can get the id of the umbraco item that is failing to load the audit trail (from the querystring, or from info tab)

    And then run this code with a breakpoint on it or 'just' write out each item in 'mapped' to 'see' which users are being returned,

    then you could even create a version of MappedAvatarsAndNames for each audit log item... to see where the error is occuring:

    https://github.com/umbraco/Umbraco-CMS/blob/d428a4543f33bb7094cf7db5f6b6fdc2d1de3063/src/Umbraco.Web/Editors/LogController.cs#L73

    and hopefully locate which audit entry doesn't have a user or has a user that has been deleted.

    Then it will be a case of either removing the audit log entry, fixing the user's avatar, or reinstating the deleted User , or updating the audit log entries for the deleted user to be assigned to a new user (probalby via SQL)

    regards

    marc

Please Sign in or register to post replies

Write your reply to:

Draft