Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Root Catalog Node causing Episerver exception

Vote:
 

Hey Episerver Commerce!

I'm working on an Episerver project, where our product catalog is manged by InRiver PIM and products are exported from PIM using a modified version of the InRiver adapter for Episerver. InRiver PIM exports its catalog in the Episerver xml-format, which is then imported by our application server. This setup has worked just fine for a long time, but lately we've run into some erros, which cause the catalog to crash due to an exception deep within Episerver's code*. We are runing Episerver Commerce 11.

I have investigated the problem a bit, and it seems like one of the nodes sent from InRiver PIM, called 'InRiverAssociations', is the root of the problem. This Node has an assigned MetaClass Called ChannelNode. Quite a few MetaFields has ChannelNode as their OwnerClass. However, the InRiverAssocation Node does not have any of these Metafields set*. Previously the Epi_IsPublished, Epi_StartPublish, and Epi_StopPublish metafields were set for this InRiverAssociation Node during the Episerver import, but it appears that this is not the case anymore. The effect is that we end up with a node completely without any data in [dbo].[CatalogContentProperty] or [dbo].[CatalogContentEx], which leads to a null reference when loading the catalog*.

I have a few questions regarding this issue:

  1. Is the Episerver catalog supposed to crash when loading the catalog if one of the root CatalogNodes doesn't have any metadata attached to it?
  2. Can you clarify when the Epi_IsPublished, Epi_StartPublish, and Epi_StopPublish metafields are created, and if anything changed in relation to those recently? Am I wrong to assume that these should be created when importing a Catalog Node?
  3. Does importing a CatalogNode without any Metafields go against any of Episerver's policies?  

Please let me know if anything is unclear, and I'll be happy to provide more context, or elaborate. 

*Specfic Information regarding the error:

Episerver Error:
System.NullReferenceException: Object reference not set to an instance of an object.
at Mediachase.MetaDataPlus.Internal.CatalogMetaObjectRepository.d__10.MoveNext()
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at EPiServer.Commerce.Catalog.Provider.Construction.MetaDataContentBuilder.GetMetaObjects(IDictionary`2 metaObjectIdsByClassId, String language)
at EPiServer.Commerce.Catalog.Provider.Construction.NodeBuilder.ConstructNodes(CatalogNodeDto nodeDto, IDictionary`2 versionForUnpublishedContent, String language)
at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc)
at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language)
at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader)
at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector)
at EPiServer.Core.ContentProvider.GetContentBatch(IList`1 batch, ILanguageSelector selector, List`1& contents, Dictionary`2& contentMap)
at EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector)
at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions)
at EPiServer.Core.Internal.DefaultContentLoader.GetChildren[T](ContentReference contentLink, LoaderOptions loaderOptions, Int32 startIndex, Int32 maxRows)
at EPiServer.Core.Internal.DefaultContentLoader.GetChildren[T](ContentReference contentLink, CultureInfo language)
at EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.FindNextContentInSegmentPair(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo)
at EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.GetCatalogContentRecursive(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo)
at EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.RoutePartial(PageData content, SegmentContext segmentContext)
... (Continues)

InRiverAssociations Node XML:


    inRiverAssociations
    2017-09-27 17:00:31Z
    2117-09-27 17:00:31Z
    True
    999
    
    6_inRiverAssociations
    00139985-0000-0000-0000-000000000000
    
        
            ChannelNode
        
        
    
    
    

Commerce DB Query of the Node causing the error (Note that it's a left-join, so the value is not null, but missing):

DB Query of CatalogNode

#184617
Edited, Oct 31, 2017 16:00
Vote:
 
  1. No it should work.
  2. They should be created automatically when importing. Nothing really changed to this area recently.
  3. No

If you can post the catalog.xml file which reproduces the problem on Quicksilver, we will look into it

#184624
Oct 31, 2017 22:29
Vote:
 

Hey Quan Mai, thanks for the quick response!

Our Catalogs are quite big, so I have tried to boil it down to a small catalog, that contains our <MetaDataScheme>, but very few nodes, and no relations, associations or entries.
We are using a [ServiceConfiguration(ServiceType = typeof(ICatalogImportHandler))] class to import, but I have been able to reproduce the problem stated above both by importing the catalog using our ICatalogImportHandler, and by using Episerver Commerce Catalog Management Import/Export directly.  

I see that the Episerver changes the ParentNodeId to 0, if an imported CatalogNode has an empty <ParentNode/> Element, or if the element contains a Code that doesn't point to any Node. We have both of these cases in the catalog - I don't know if that could be related at all.  

Episerver Commerce version: 11.1

Catalog: https://netcompany-my.sharepoint.com/personal/nsr_netcompany_com/_layouts/15/guestaccess.aspx?docid=1b64c5b076521476a89759ed0f123739c&authkey=AWHz25lxaKPqw2j5rHTfJf4&e=2796a3bda3004ed3b71d9c32a7884660    (Let me know if you prefer some other way of sharing the file)

Problem: The <Name>inRiverAssociations</Name> Node doesn't have any metafields when importing the catalog, which leads to erros when loading it.

Let me know if you need any further details from me. I'm continually looking into the problem myself, but I've been unable to located what has changed, since this problem didn't previously occur - maybe the metadatascheme changed in some unfortunate way.

#184777
Nov 03, 2017 11:41
Vote:
 

I imported the file and it works fine:

What suprised me is that inRiverAsssocations is not published. It should. However the other two are published. There might be magic here but that would need some investigation 

#184802
Nov 03, 2017 22:26
Vote:
 

It's interesting that you can open the catalog. 

I tried to access the catalog through the Commerce tab like you did in the picture, but with the same result as before.

Since we use the same catalog, and I imported the code directly through Episerver Commerce Catalog Management Import/Export, so none of our code was involved, I wonder what the difference between our Episever instances is, since it works for you. Maybe we aren't using the exact same Episerver CMS/Commerce versions. (Commerce: 11.1, CMS: 10.10.3). 

When you say that the inRiverAssociations Node is not published when you import the catalog, do you mean that the Epi_IsPublished metafield is set to 0 for the Node, or that the Node has no metafields at all, which is the case when I import the catalog? If the Epi_IsPublished, Epi_StartPublish, and Epi_StopPublish metafields were created for the Node, when you import the catalog, then it makes sense that you can access it.

Your continued help is appreciated.

Se Webshop catalog error

#184803
Nov 04, 2017 2:33
Vote:
 

Hey again.

The exception above stems from the following bug: http://world.episerver.com/support/Bug-list/bug/COM-5260. The bug was reported for Episerver Commerce 11.1, the version we were running, and has been solved as of version 11.2. This means that loading/rendering CatalogNodes without metadata no longer gives an exception. 


This only leaves the question whether importing CatalogNodes without any metafields, like InRiverAssociations, should result in an unpublished CatalogNode lacking the Epi_IsPublished, Epi_StartPublish, and Epi_StopPublish metafields, resulting in a state with no metadata at all. If anyone can confirm that this is not the intended behavior in Episerver, then I will create a Bug/Case for it through Episerver Support.

 

#185596
Nov 27, 2017 11:59
Vote:
 

I think it should be published as long as there is a name specificed.

#185649
Nov 28, 2017 18:16
Vote:
 

If IsActive is true, it should be published if Epi_IsPublished is not present. I'd suggest you to contact developer support - if we have the catalog which can reproduce the issue, we're happy to look into it.

#185650
Nov 28, 2017 20:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.