Copied to clipboard

Flag this post as spam?

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


  • ZNS 60 posts 198 karma points
    Oct 31, 2018 @ 10:09
    ZNS
    0

    Strange exception in media browser

    One of our production sites has all of the sudden started to throw an exception when browsing certain media folders.

    As you can see it's possible to open the folder "Bo" in the tree. But when a user clicks on it they get this error message.

    http://prntscr.com/lcm0sw

    It's also possible to click on every image/folder beneath "Bo" in the tree without any error.

    Below is the exception in the log. Seems to have something to do with a missing user?


    2018-10-31 10:46:43,952 [P11208/D2/T115] ERROR Umbraco.Web.Editors.MediaController - Unhandled controller exception occurred AutoMapper.AutoMapperMappingException:

    Mapping types: Media -> UserProfile Umbraco.Core.Models.Media -> Umbraco.Web.Models.ContentEditing.UserProfile

    Destination path: ContentItemBasic`2.Owner.Owner

    Source value: Umbraco.Core.Models.Media ---> System.NullReferenceException: Object reference not set to an instance of an object. at Umbraco.Core.Services.UserService.GetProfileById(Int32 id) at Umbraco.Web.Models.Mapping.OwnerResolver1.ResolveCore(TPersisted source) at AutoMapper.ValueResolver2.Resolve(ResolutionResult source) in c:\dev\AutoMapper\src\AutoMapper\ValueResolver.cs:line 12 at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func3 func) at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap) in c:\dev\AutoMapper\src\AutoMapper\Mappers\TypeMapObjectMapperRegistry.cs:line 116 --- End of inner exception stack trace --- at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap) in c:\dev\AutoMapper\src\AutoMapper\Mappers\TypeMapObjectMapperRegistry.cs:line 153 at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.Map(ResolutionContext context, IMappingEngineRunner mapper) in c:\dev\AutoMapper\src\AutoMapper\Mappers\TypeMapObjectMapperRegistry.cs:line 89 at AutoMapper.Mappers.TypeMapMapper.Map(ResolutionContext context, IMappingEngineRunner mapper) in c:\dev\AutoMapper\src\AutoMapper\Mappers\TypeMapMapper.cs:line 22 at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) in c:\dev\AutoMapper\src\AutoMapper\MappingEngine.cs:line 250 at AutoMapper.MappingEngine.Map[TSource,TDestination](TSource source) in c:\dev\AutoMapper\src\AutoMapper\MappingEngine.cs:line 78 at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext) at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)

  • ZNS 60 posts 198 karma points
    Oct 31, 2018 @ 13:07
    ZNS
    0

    I had some columns in both cmsDocument and umbracoNode tables where the user didn't exist in the user table. How that can have happened I don't know. Doing an update on those columns and setting a userid that exists seems to have worked...

  • David Quinlan 6 posts 99 karma points
    Jan 03, 2019 @ 12:08
    David Quinlan
    102

    Thanks! this fixed my issue also. We'd removed users from db.. accidentally causing this issue.

    Fixed with following query..

    update cmsDocument
    set documentUser = {a valid user}
    where documentUser not in (select id from umbracoUser)
    
    update umbracoNode 
    set nodeUser =  {a valid user} 
    where nodeUser not in (select id from umbracoUser)
    
  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Mar 25, 2019 @ 09:40
    Alex Skrypnyk
    0

    Thanks, David !!!

  • Owain Williams 482 posts 1414 karma points MVP 7x c-trib
    Jul 08, 2020 @ 11:15
    Owain Williams
    0

    This has just saved me hours of investigating. Thanks for the script David!

Please Sign in or register to post replies

Write your reply to:

Draft