We are using Sitecore Commerce and it's default registration functionality.
It was working fine and today, there is a new error when a user tries to register on site.
Register: Index commerce_userprofiles_index_master was not found
I tried rebuilding the index for the same, but still the same error.
Using Sitecore 8.2
UPDATE:
This is a distributed environment and there is no issue in the CM server. The error occurs in only the CD server.
On further investigation, we found that this file was disabled in CD: CommerceServer.ContentSearch.Solr.Index.Master.config
This master config has an index configuration which was not available in CommerceServer.ContentSearch.Solr.Index.Web.config
:
<index id="commerce_userprofiles_index_master" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/commerceSolrProfileUserObjectIndexConfiguration" />
<locations hint="list:AddCrawler">
<crawler type="Sitecore.Commerce.Connect.CommerceServer.Search.UserProfileCrawler, Sitecore.Commerce.Connect.CommerceServer">
<ProfileType>UserObject</ProfileType>
<AddressPropertiesToIndex>
GeneralInfo.address_line1, GeneralInfo.address_line2, GeneralInfo.city, GeneralInfo.region_code, GeneralInfo.region_name, GeneralInfo.postal_code, GeneralInfo.country_name, GeneralInfo.country_code, GeneralInfo.tel_number
</AddressPropertiesToIndex>
</crawler>
</locations>
</index>
As master.config was disabled, I copied this piece to the solr.index.web.config and it now works fine.
We are told, that in CD, master references are disabled. So, please advise, is what I did correct or is there another way to solve it.
Code which is called on Register button click:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
[OutputCache(NoStore = true, Location = OutputCacheLocation.None)]
[SkipAnalyticsTracking]
public JsonResult Register(RegisterUserInputModel inputModel)
{
try
{
Assert.ArgumentNotNull(inputModel, nameof(inputModel));
var result = this.CreateJsonResult<RegisterApiModel>();
if (result.HasErrors)
{
return Json(result, JsonRequestBehavior.AllowGet);
}
var response = AccountManager.RegisterUser(inputModel);
if (response.ServiceProviderResult.Success && response.Result != null)
{
result.Initialize(response.Result);
MailManager.SendMail("CommerceUserRegistrationSuccess", inputModel.UserName);
AccountManager.Login(response.Result.UserName, inputModel.Password, false);
}
else
{
result.SetErrors(response.ServiceProviderResult);
}
return Json(result);
}
catch (Exception e)
{
return Json(new ErrorApiModel("Register", e), JsonRequestBehavior.AllowGet);
}
}