THIS IS ARCHIVED DOCUMENTATION

Content Database ‘master’ Not Found on a Content Delivery Server

Sitecore 9.1 Coveo for Sitecore 4.1 (May 2019)

Symptoms

When deploying Coveo for Sitecore on a Content Delivery instance, you get the following error:

Content database 'master' not found.
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: System.InvalidOperationException: Content database 'master' not found.

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:


[InvalidOperationException: Content database 'master' not found.]
   Sitecore.Context.get_ContentDatabase() +488
   Coveo.Framework.Utils.SitecoreContextWrapper.GetCurrentDatabaseName() +31
   Coveo.SearchProvider.Utils.CoveoIndexUtilities.GetDefaultCoveoIndex(ISitecoreContext p_SitecoreContext, ICoveoIndexFetcher p_CoveoIndexFetcher) +216
   Coveo.SearchProvider.Rest.SitecoreRestHttpHandlerDispatcher.ProcessRequest(HttpContext p_Context) +169
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +866
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +91

Cause

The coveoapi site is missing a patch specific to CD environments.

Resolution

Immediate Steps

In the Coveo.Authentication.config file, change the following line:

<site patch:before="*[1]" name="coveoapi" virtualFolder="/coveo" physicalFolder="/coveo" enableTracking="false" content="master" domain="sitecore" set:loginPage="$(loginPath)shell/SitecoreIdentityServer" />

to this:

<site patch:before="*[1]" name="coveoapi" virtualFolder="/coveo" physicalFolder="/coveo" enableTracking="false" content="master" domain="sitecore" set:loginPage="$(loginPath)shell/SitecoreIdentityServer">
    <patch:attribute role:require="ContentDelivery" name="content">web</patch:attribute>
</site>

Final Steps

This issue is resolved in the May 2019 release of Coveo for Sitecore 4.1. Upgrade Coveo for Sitecore to the May 2019 release.