Copied to clipboard

Flag this post as spam?

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


  • nickornotto 397 posts 900 karma points
    Aug 10, 2020 @ 09:23
    nickornotto
    0

    TypedMediaAtRoot returns null despite media folders exist

    public IPublishedContent GetRootMedia(string mediaFolder)
    {
        var mediaRoots = _umbHelper.TypedMediaAtRoot();
        return mediaRoots.FirstOrDefault(f => f.Name == mediaFolder);
    }
    

    mediaRoots it returns empty collection despite there are a few media folders at root. This seems to happen every some time though - not every time or not for every member.

    _umbHelper.MediaAtRoot();
    

    produces the same (null) result.

    Why would it happen?

    Umbraco 7.15.3

  • Marc Goodson 2141 posts 14324 karma points MVP 8x c-trib
    Aug 10, 2020 @ 19:50
    Marc Goodson
    0

    Hi nickornotto

    Just a thought, is your Examine InternalIndex populated?

    I think there is a caching layer when querying Media that uses the Examine internal index, sometimes if this index is empty or corrupt, you get unpredictable results when querying for media.

    regards

    Marc

  • nickornotto 397 posts 900 karma points
    Aug 11, 2020 @ 08:34
    nickornotto
    0

    Hi Marc, Thanks for replying.

    The Internal index is running and there is no sign of it erroring when the media error happens.

    Sometimes the error keeps happening for the same members all over again while is not happening for others though.

    I can sometimes replicate it in local environment either.

  • nickornotto 397 posts 900 karma points
    Sep 14, 2020 @ 07:52
    nickornotto
    0

    Also replying about the index - the internal index is running and the umbraco CMS works fine, so the index is working but for some reason the API does not get the result.

    Also I have deleted the external index, the index has been recreated and the issue persists.

    To me it looks like the bug in the API.

Please Sign in or register to post replies

Write your reply to:

Draft