Copied to clipboard

Flag this post as spam?

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

  • Jacob Brock-Hansen 10 posts 120 karma points
    15 days ago
    Jacob Brock-Hansen

    Why is descendants failing in my deployed instance

    Hi - Im pretty new to Umbraco and i ran into a weird problem that im hoping you can help me with.

    I have a website that is built in umbraco 9, and in that website i added an UmbracoApiController because i want to allow another system to create some custom records in my database. It could be news for instance that is created from an outside system and shown in my website.

    This works fine as long as im running my website and testing my API from Postman, but when i deploy my site and my new endpoint to the cloud (Azure) it stops working.

    Im using this piece of code:

    Home homeNode = null;
    foreach (IPublishedContent root in _context.UmbracoContext.Content.GetAtRoot().ToList())
        GenericSettingsPage settings = root.Descendant<GenericSettingsPage>();
        if (settings != null)
            if (settings.RemoteIdentifier.Equals(remoteIdentifier, StringComparison.InvariantCultureIgnoreCase))
                homeNode = (Home)_context.UmbracoContext.Content.GetById(root.Id);
    if (homeNode != null)
        //This works
        return new List<RecordTemplate>
        //This does not work
        //return homeNode.Descendant<RecordTemplateList>().Descendants<RecordTemplate>().ToList();

    Where RemoteIdentifier is a value im using the match against a root node and find a settings page that im using for the record creation.

    My endpoint is secured with a JWT token.

    I dont understand why this is an issue. I can get the recordTemplates through the ID so i believe i have access to them, and it works when running locally in debug mode - so why is this failing?

    Oh the actual error im getting is a Reference not set to an instance on the object on the Descendants

  • Jacob Brock-Hansen 10 posts 120 karma points
    1 week ago
    Jacob Brock-Hansen

    Just an update on this issue.

    We upgraded from the pre release version to the release version and now all of it works - so this is just a prerelease issue

Please Sign in or register to post replies

Write your reply to: