Tuesday 3 December 2019

Sitecore Commerce 9.2 Business tools error with invalid shop


Problem Description

I was playing with Sitecore Commerce 9.2 recently. installation works perfectly fine it works really well. While playing with it, I was changing a lot of configurations and services to check a few things.
Suddenly I started getting an error on Sitecore Commerce Business tools and not loading any menu on Business tools as shown in the following images.



After a few retries in the loop, we saw for request GetNavigationView() and GetLanguageView() returns 400 Bad requests.

and the response was 

{  "@odata.context":"https://commerceauthoring.commerce.com/Api/$metadata#Sitecore.Commerce.Core.CommandMessage","MessageDate":"2019-12-03T16:37:39.4253344Z","Code":"Error","Text":"Shop 'CommerceEngineDefaultStorefront' does not exist.","CommerceTermKey":"InvalidShop"
}

the similar error I was getting in PostMan request too

{
  "@odata.context""https://localhost:5000/Api/$metadata#Sitecore.Commerce.Core.CommandMessage",
  "MessageDate""2019-12-03T16:26:47.0334391Z",
  "Code""Error",
  "Text""Shop 'CommerceEngineDefaultStorefront' does not exist.",
  "CommerceTermKey""InvalidShop"
}

Solution: 

I have tried  many things but in last in I come to know that Sitecore 9.2 Commerce use Redis cache and if Redis service is not running, you will get above error. So make sure that Redis cache is kept running. As soon as started, Redis cache everything works again. 


Happy commercing..........






Thursday 22 August 2019

Sitecore Commerce: DevOps Tasks Trigger from Sitecore Experience Platform


I have recently started playing and learning Sitecore Commerce. There are few tasks like configuration and administration of Sitecore commerce is needed, there is a special role DevOps associated to perform those tasks.

The DevOps role is an instance of the Commerce Engine that is internal and only available to DevOps personnel. This role can be assigned higher privileges allowing DevOps personnel to perform maintenance tasks that are not permitted to other roles (for example, bootstrapping and environment initialization functions). Sitecore has given lots of  OOTB Postman Collections.  Which is really good for extending pipeline and Pipeline blocks.

I found that it can be painful when you need to run a task very quickly and efficiently on production. There is a possibility to make a mistake in request and it will be time-consuming too.

Sitecore Commerce requires the Sitecore PowerShell module, SXA, and SXA storefront(if you are using it.) So I thought it is better to trigger a few tasks like  Bootstrapping, Rebuild index tasks, Purge tasks, Minion Task(Pending order task, Release order task, Waiting for order task, etc ) from Sitecore directly. This package provides a Sitecore package with PowerShell script.

Note: This module tested on Sitecore 9.1 update 1 released with Sitecore Commerce 9.1 and Powershell 5.0 

There are a few steps to perform

1.  Install-Package (do not install on production without testing to local/dev/test environment)

How to Use it

1. After installing Package go to "/sitecore/system/Modules/PowerShell/Script Library/Commerce DevOps/Commerce DevOps Settings"

And update setting as per your need.


2. Create a new user based on "Sitecore\Commerce Dev  Ops" role
3. Log in with a new user 
4. You can see a new area in a control panel 

5. To Bootstrap environment Click on "Bootstrap Commerce Environment," It will challenge you to enter a password (if you set default password in setting item it will appear if you have not set up default it will be blank).

6. To Run Minon Click on Minion Tasks.  It will give a drop-down list of tasks to select one.


7. You can see task run successfully or not, To see the result  click on "View Script result"


Happy Commercing !!