EmailReportsTask fails without Master database


Description

The following exception may occur in Sitecore log files on Sitecore instances that have Sitecore Analytics enabled while not being configured with a Master database.

The error occurs when Sitecore executes the Sitecore.Analytics.Tasks.EmailReportsTask scheduled task and in typical configurations would happen in the CD environment.
ERROR Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Jobs.Job.ThreadEntry(Object state)
Nested Exception
Exception: System.InvalidOperationException
Message: Could not find configuration node: databases/database[@id='master']
Source: Sitecore.Kernel
   at Sitecore.Diagnostics.Assert.IsTrue(Boolean condition, String message)
   at Sitecore.Configuration.Factory.GetConfigNode(String xpath, Boolean assert)
   at Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert)
   at Sitecore.Configuration.Factory.GetDatabase(String name)
   at Sitecore.Analytics.Tasks.EmailReportsTask.GetLastRun()
   at Sitecore.Analytics.Tasks.EmailReportsTask.IsDue()
   at Sitecore.Analytics.Tasks.EmailReportsTask.Run()

Solution

Apply instructions from the Configuring Scheduling chapter of the Scaling Guide document to disable the task, or configure it to use another database.