1

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);
    }
}
7
  • 1
    Can you check whether Solr core with name "commerce_userprofiles_index_master " is present on Solr server? Use Solr Admin UI for that -> lucene.apache.org/solr/guide/6_6/…. On the left side you should have core selector. Is this core present there? Commented May 15, 2018 at 11:58
  • @PeterProchazka Could you pls check my update and share your thoughts,
    – sukesh
    Commented May 15, 2018 at 14:06
  • 1
    Great additions to original question. It shed some more light :) As a best practice you shouldn't access any master index from CD environments. You have maybe somewhere in code hardcode access to commerce_userprofiles_index_master index. Please revise your code and change it to something like this var indexName = String.Format("commerce_userprofiles_index_{0}", Sitecore.Context.Database.Name); var index = ContentSearchManager.GetIndex(indexName); Commented May 15, 2018 at 14:38
  • 1
    Maybe add into your question also code that uses this index to see how index is used. If this will solve your issue, I will create more detailed answer Commented May 15, 2018 at 14:39
  • I checked the entire solution and itsn't hardcoded anywhere
    – sukesh
    Commented May 15, 2018 at 15:18

1 Answer 1

6

I had the same issue, but in my case we used Lucene.

The "commerce_userprofiles_index_master" is used by the "Customer&Order Manager" which is typically only used on CM inside Sitecore client. The C&O manager needs this index to find users created on runtime site.

You should disable the pipeline processors inside the <commerce.customers.createUser> (so as update/delete) in CommerceServer.Customers.config on your CD environment unless you need run C&O manager on CD in order to avoid errors.

In such a CM/CD distributed deployment, the commerce_userprofiles_index_master needed on CM side will not be updated when users are created in runtime site on CD side.

As a workaround for the issue, there are 2 options:

  1. Using SOLR - then CommerceServer.ContentSearch.Solr.Index.Master.config should be enabled on a CD server as well as create\update\delete processors in CommerceServer.Customers.config.
  2. Perform a FULL INDEX REBUILD for commerce_userprofiles_index_master on CM server in a timely manner.
  3. Disable the pipeline processors inside the (so as update/delete) in CommerceServer.Customers.config on your CD environment. (Side effect: You will not be able to see new customers in C&O until you do the FULL Rebuild)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.