Exception is thrown when a page is visited by robots


Description

Search engines might fail to index pages with the following error. The issue happens with the pages that have Commerce campaigns and goals assigned or triggered via code.

Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Commerce
  Sitecore.Commerce.Pipelines.Common.TriggerPageEvent.Process(ServicePipelineArgs args) +1443
  (Object , Object[] ) +82
  Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +364
  Sitecore.Commerce.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +69
  Sitecore.Commerce.Services.ServiceProvider.RunPipeline(String pipelineName, TRequest request) +281
  Sitecore.Reference.Storefront.Managers.CatalogManager.VisitedCategoryPage(CommerceStorefront storefront) +261
   Sitecore.Reference.Storefront.Controllers.CatalogController.VisitedCategoryPage() +36
   ...

Solution

To resolve the issue, consider one of the following options: