One of the most important skills regarding Sitecore Commerce development is to find the correct commands and pipelines to extend the behavior of the Commerce engine. In this article I will introduce some useful tools to support you.
Fiddler is a free web debugging proxy developed by Telerik. With this tool you will be able to capture the traffic between the Sitecore storefront and the Sitecore Commerce engine.
Because Sitecore XC 9.1 uses https for each connection by default, we must enable https capturing in the fiddler options:
- Click Tools > Fiddler Options > HTTPS.
- Check the Decrypt HTTPS Traffic box.
- Click on Skip decryption to change it to Perform decryption only for the following hosts.
- Add required host names, e.g. localhost, commerceauthoring.sc9.qa
- This will depend on your configuration used at the installation of Sitecore Commerce.
The first time you activate https capturing you have to trust the FiddlerRoot Certificate. This root certificate is required because fiddler will decrypt the traffic and encrypt it with a certificate signed by this root certificate.
Because all traffic is directly on the local machine Fiddler will not be able to capture it. Therefore, we must change the web.config of the storefront to use Fiddler as proxy. You can read more about this topic on the Fiddler web site.
<configuration> <system.net> <defaultProxy> <proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" /> </defaultProxy> </system.net> </configuration>
Now you can capture traffic from the storefront to the Commerce Engine.
If you stop Fiddler you will get error messages, because the storefront is no longer able to connect to the Commerce Engine. Therefore, you must disable the proxy configuration in the web.config when you don’t need Fiddler.
2) Plumber Configuration Viewer
Plumber Configuration Viewer for Sitecore Commerce is developed by Erwin Werkman. It is a useful tool to browse the configuration of your Commerce Engine. The configuration viewer is a separate web site. To install and configure this site, just follow the instructions of the Readme on GitHub.
3) Commerce Engine Log Files
The Commerce Engine writes a log file containing the used configuration for the pipelines and blocks. You can find the log file inside the website folder -> wwwroot -> logs. The name of the log file starts with NodeConfiguration_Deployment.
On my system the location of the log file for the authoring role is:
This log files can by handy especially on remote systems.
The SDK of the Sitecore Commerce engine comes with some Postman collections. With these collections you get a good overview of the available commands. Postman is also a handy tool when it comes to debugging the commerce engine.
After you have installed Postman, you must import the collections:
- Click File > Import…
- Click Import Folder > Choose Folders
- Navigate to the Sitecore Commerce Engine SDK folder, select the postman folder and click on Select Folder
- If not already selected, click on the Collections tab.
Because the Commerce Engine is using self-signed certificates, we must disable SSL certificate verification:
- Click File > Settings
- Click General > SSL certificate verification.
- Ensure that the value is no OFF
Maybe you have to edit the environment values. On my machine I had to update the value for SitecoreIdServerHost to the value https://playground.identityserver.
After everything is set up, you can test the API methods. Before you call any other API method you must request an authentication token.
You can find a more detailed instruction for setting up Postman on the Blog tothecore.sk.
I hope you find this overview helpful. If you have questions to any of these tools, please leave a comment.
You know other helpful tools? Please share it in the comments.