Sitecore Publishing Service: Could not resolve stores web of type source
This article aims to save time for anyone who encounters the same error I faced while configuring the Sitecore Publishing Service.
At some point during the configuration of our Sitecore Publishing Service, I encountered an unfamiliar error:
Error: "Could not resolve stores web of type source"
System.Exception: Could not resolve stores web of type source
at Sitecore.Framework.Publishing.Data.DefaultStoreFactory.CreateSources(DataAccessContextType dataAccessContext, String[] names)
at Sitecore.Framework.Publishing.PublishContext..ctor(IStoreFactory storeFactory, PublishOptions publishOptions, Guid jobId, DateTime started)
at Sitecore.Framework.Publishing.PublishContextFactory.Create(IStoreFactory storeFactory, PublishOptions publishOptions, Guid jobId, DateTime started)
at Sitecore.Framework.Publishing.Tasks.PublishTask.OnExecute(IScheduledTaskExecutionContext context)
At first glance, the error seems to indicate a problem with the stores or the source type. However, the error message itself doesn’t clearly explain the issue, at least not initially. After some investigation and checking the configuration files, I discovered that the cause of the error—and its solution—was actually quite simple.
I attempted to run the publish when my context database in Sitecore was set to “web.” Even if you initiate a full publish from the Publishing Dashboard, Sitecore retains your last selected context database and tries to use it as the source for publishing. This error can also appear as: Could not resolve stores core of type source, or even with the name of any custom database you have in your Sitecore instance.
Additionally, if the Publishing Service is not installed at all, a similar error will appear in the Sitecore logs when attempting to publish from an unsupported source database.