Saturday, July 6, 2019

Sitecore Commerce 9.2 - Steps to deploy the solution with the first plugin.


Sitecore has provided a good documentation to set up the first plugin and deploy that plugin into your local environment for the test and can release those changes to test/staging and production environment.

Here are a few simple steps -

You need to open out of the box solution  Customer.Sample.Solution, You can find this project in Sitecore.Commerce.Engine.SDK.4.0.102.



Open the solution in VS2017 and build the project.



As per the Sitecore documentation, there are three options -

  1. Directly in Visual Studio using the Publish option
  2. Through a command line, using the dotnet publish command
  3. Inside a Build environment, as part of a Continuous Integration environment
Click on the publishing option -


If you are deploying this first time, I would recommend taking a backup of IIS site, because we need to update a few configurations.

Change the path to the file system -



There are total four environments in SXC - We need to deploy this release package accordingly.




After the deployment, I found below error -

Catalog Item of the Storefront catalog Configuration cannot be found.


I attached the debugger and found this issue at two places.



I have captured the error -
Inner Exception 1:
HttpUnhandledException: An unhandled exception occurred.

Inner Exception 2:
InvalidOperationException: Catalog Item of the Storefront catalog Configuration cannot be found.

   at ASP._Page_Views_SxaLayout_BootstrapBody_cshtml.Execute() in c:\inetpub\wwwroot\SC921sc.dev.local\Views\SxaLayout\BootstrapBody.cshtml:line 20
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()

   at ASP._Page_Views_SxaLayout_SxaLayout_cshtml.Execute() in c:\inetpub\wwwroot\SC921sc.dev.local\Views\SxaLayout\SxaLayout.cshtml:line 31
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()

Steps to debug and resolve this issue - 

All the related logs can be found here - C:\inetpub\wwwroot\SC921sc.dev.local\App_Data\logs\

Nested Exception

Exception: System.InvalidOperationException
Message: Catalog Item of the Storefront catalog Configuration cannot be found.
Source: Sitecore.Commerce.XA.Foundation.Common
   at Sitecore.Commerce.XA.Foundation.Common.Models.CommerceStorefront.get_CatalogItem()
   at Sitecore.Commerce.XA.Feature.Catalog.Repositories.ProductFacetsRepository.GetProductFacetsRenderingModel(String searchKeyword, Nullable`1 pageNumber, String facetValues, String sortField, Nullable`1 pageSize, Nullable`1 sortDirection, StringPropertyCollection propertyBag)
   at Sitecore.Commerce.XA.Feature.Catalog.Controllers.CatalogController.ProductFacets(String searchKeyword, Nullable`1 pageNumber, Nullable`1 pageSize, String facetValues, String sortField, Nullable`1 sortDirection)
   at lambda_method(Closure , ControllerBase , Object[] )

As per this blog we need to turn on the Sitecore.Commerce.Engine.Connectors.Index.Azure.config under this folder C:\inetpub\wwwroot\SC921sc.dev.local\App_Config\Include\Y.Commerce.Engine

The issue didn't resolve after enabling this config file.

I check the path - /sitecore/content/Sitecore/Storefront/Home/Catalogs and didn't see the catalog configuration.




In my case, I found that when I deploy a new solution it somehow has removed the Habitat catalog.

Let's create a new catalog here -

Here is the insert template 



I can't see the insert option in the catalog item.



So, I have decided to install it again for the storefront catalog.

Here we are after the new setup -


When I browse the SXA site, I got the Illegal modal issue but it got resolved after the refresh.


I simply copied the DLL into four environments and now got the below error -

Server Error in '/' Application.

Index sitecore_web_index was not found


There is an official fix for this issue - Download the fix



It didn't work. I have reset the catalogue and updated it manually.