Content delivery instance crashes at index initialization

In this article

Symptoms

On a Sitecore ContentDelivery instance, you get an error message like the following:

Server Error in '/' Application.
Could not find add method: AddIndex (type: Sitecore.ContentSearch.ContentSearchConfiguration)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Sitecore.Exceptions.RequiredObjectIsNullException: Could not find add method: AddIndex (type: Sitecore.ContentSearch.ContentSearchConfiguration)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[RequiredObjectIsNullException: Could not find add method: AddIndex (type: Sitecore.ContentSearch.ContentSearchConfiguration)]
   Sitecore.Configuration.DefaultFactory.AssignProperties(Object obj, Object[] properties) +1704
   Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +620
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +320
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +703
   Sitecore.ContentSearch.ContentSearchManager.get_SearchConfiguration() +311
   Sitecore.ContentSearch.SolrProvider.SolrContentSearchManager.Initialize() +21
   (Object , Object ) +9
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
   Sitecore.Nexus.Web.HttpModule.Application_Start() +215

Cause

A Coveo.SearchProvider.Custom.config patch blueprint introduced in the April 18, 2019 release of Coveo for Sitecore doesn’t properly support a scenario where the server role is ContentDelivery.

Resolution

  1. Open file <SITECORE_INSTANCE_ROOT>\App_Config\Include\Coveo\Coveo.SearchProvider.Custom.config in a text editor.

  2. Change the following line:

    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:coveo="http://www.sitecore.net/xmlconfig/coveo/">

    to

    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:coveo="http://www.sitecore.net/xmlconfig/coveo/">
  3. Change the following line:

    <index id="Coveo_master_index">

    to

    <index role:require="!ContentDelivery" id="Coveo_master_index">
  4. Save your changes.