volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

AI OnAI Off

Error loading products

Hi,

I'm investigating an error, that happens when he try to load a page with product data. A database rollback previously solved the issue, but now it's back. 

base.RoutePartial(content, segmentContext);

And the exception:

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Commerce.Catalog.Provider.MetaDataPropertyMapper.AssignMetaFieldValueToProperty(PropertyData property, Object metaFieldValue, MetaDataType metaDataType, String blockPropertyMetaFieldName) +1083
   EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.AddMetaDataAttributePropertyValues(MetaObjectAccessor accessor, CatalogContentBase content) +1247
   EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.LoadProperties(CatalogEntryRow entryRow, CatalogItemSeoRow seoRow, VariationRow variationRow, EntryContentBase content, MetaObjectAccessor metaObjectAccessor) +245
   EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.ConstructEntries(CatalogEntryDto entryDto, IDictionary`2 versionsForUnpublishedContent, IList`1 entryNodeRelations, String language) +1565
   EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.Create(IList`1 contentLinks, String language) +875
   EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc) +511
   EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language) +607
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader) +246
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector) +752
   EPiServer.Core.ContentProvider.GetContentBatch(IList`1 batch, ILanguageSelector selector, List`1& contents, Dictionary`2& contentMap) +127
   EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector) +1019
   EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions) +326
   EPiServer.Core.Internal.DefaultContentLoader.GetChildren(ContentReference contentLink, LoaderOptions loaderOptions, Int32 startIndex, Int32 maxRows) +1721
   EPiServer.Core.Internal.DefaultContentLoader.GetChildren(ContentReference contentLink, CultureInfo language) +196
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.FindNextContentInSegmentPair(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo) +311
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.GetCatalogContentRecursive(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo) +200
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.RoutePartial(PageData content, SegmentContext segmentContext) +347
   Vertica.Pompdelux.Business.Infrastructure.Routing.CustomHierarchicalCatalogPartialRouter.RoutePartial(PageData content, SegmentContext segmentContext) in C:\Projects\POMPdeLUX\src\Business\Infrastructure\Routing\CustomHierarchicalCatalogPartialRouter.cs:64
   EPiServer.Web.Routing.Segments.Internal.PartialSegment.RouteDataMatch(SegmentContext context) +358
   System.Linq.Enumerable.All(IEnumerable`1 source, Func`2 predicate) +170
   EPiServer.Web.Routing.Internal.DefaultContentRoute.RouteSegmentContext(SegmentContext segmentContext) +16
   EPiServer.Web.Routing.Internal.DefaultContentRoute.GetRouteData(HttpContextBase httpContext) +470
   System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +239
   EPiServer.Web.Routing.RouteCollectionExtensions.HandleRouteData(RouteCollection routes, HttpContextBase context) +30
   EPiServer.Global.DefaultDocumentHandling(Object sender, EventArgs e) +180
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93

Any help is appreciated :) 

#248828
Feb 18, 2021 10:23

The "object reference" is a very generic error. Are you on DXP? Can you check Application Insight and check failed request and see telemetry. it will give you a hint of what the website is trying to get from the database. 

if you are not on DXP then you can use Sql profiler. 

#248870
Feb 19, 2021 12:35

I've experienced this exception from the same method in MetaDataPropertyMapper.AssignMetaFieldValueToProperty when I remove a property from a local block that has been used in product content. I suspect that the null reference happens because AssignMetaFieldValueToProperty cannot find the property to assign the value to. I'm running Commerce 14.

I would say this is a bug. Seems like it only happens for properties in a localblock used in a commerce type.

A workaround is to keep the property in code and add [Obsolete] and [Scafolding(false)] attributes to hide and stop using them.

#308824
Sep 21, 2023 7:59

I would suggest to contact support service for further assistance. You then can obtain the pdb files to see what metafield/property is causing error

#308871
Sep 22, 2023 6:31
* 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.