Posts

Create Script, Action, and Trigger in Sitecore Content Hub

Image
Sitecore Content Hub provides a script editor feature to write custom scripts and perform our business logic. Depending on the type of script and use cases, we can trigger the script manually or automatically using triggers. 1. Script: Sitecore Content Hub offers the following Script types . To create a script in Sitecore Content you can refer to the blog post:  Execute Content Hub Script using Postman 2. Action: Sitecore content Hub offers Action to perform a specific task. Action can either triggered by the user or automatically run by trigger or via the API. To create an action, go to the Content Hub dashboard using the manage icon and click on the Action icon: It will open an Action page window, click on the add New Action icon: In the popup window, provide the Name and Label of the action, Type I am selecting Action Script, choose the script that we created earlier, and click save: Your action has been created: For another Actio...

Execute Content Hub Script using Postman

Image
Sitecore Content Hub provides a script editor feature to write custom scripts and perform our business logic. Depending on the type of script and use cases, we can trigger the script manually or automatically using triggers. In this blog post, I am explaining how to execute the script manually using Postman. To execute the script from Postman, you need the Script URL and X-Auth-Token. Go to the Content Hub dashboard using the manage icon and click on the Script icon: It will open a Scripts page window, click on add new script icon: In the popup window, provide the Name and Type of the script and click save, I am choosing Action type here: Search your script in the Script window and click on the script name, it will open the script editor to write a script: Click on the Edit icon write the custom script and save the changes button: Click on the Build button, it builds your scripts and lets you know about the build status in the build output whe...

Sitecore xDB Sync token is no longer valid for the [Contacts] Table

Image
After execution of the Rebuild index on xDB app service I observed that in SOLR Cloud, the data is not reflected in the xdb_internal collection but is being updated in the xdb_rebuild_internal collection. I have checked the Application Insight and found the following exception: In regards to the Errno 50000: Sync token is no longer valid for [Contacts] table error, Rebuilding the xDB index in Solr  should fix it but regrettably, it could not fix my issue. Indeed, when rebuilding the xDB index, the rebuild collection will be updated, and you will need to swap the cores to ensure that the newly rebuilt core is active instead of the prior one. This is mentioned in the " Confirm rebuild " part of the documentation. Therefore, I tried swapping the core mentioned in the Sitecore documentation but unfortunately, it's not working and returning me the error: "Not supported in SolrCloud". I have gone through the SOLR guide documen...

Sitecore Technology MVP Journey 2024

Image
Honored to Receive the Sitecore Technology MVP Award for the Third Consecutive Year!. Getting the badge of Sitecore MVP the third time in a row particularly in Technology for me is one of them. My journey for Sitecore MVP begins in the Year 2019. I commenced with Sitecore Technology blogs , and actively participated in the Sitecore Stack Exchange Platform , Sitecore Slack Channel , and SUGCON public speaking. I am honored to be named Sitecore Technology MVP 2024 . I feel fortunate to be participating with a Sitecore Community, Technology, and Product. I am happy that my all efforts and contributions are recognized by Sitecore and the Community. My next focus for this year would be: Exploring more in Sitecore composable including Personalize and CDP, Content Hub, and XM Cloud. Continuing with sharing and helping others in the Sitecore Community. Participating in Sitecore MVP mentorship program. A big thanks to my family, colleagues,...

Sitecore Log File Generation Issue on Azure PaaS

Image
After deploying the Sitecore application on Azure PaaS, I noticed that the physical log files are absent from our PROD CM app service. I can find log files on the day of deployment, but for the subsequent days, the log files are not present on the PROD CM app service. It appears that whenever I perform a deployment, the old worker process (w3wp) retains an exclusive lock on the log file while shutting down, simultaneously, a new w3wp process is created and attempts to access the same log file. Since the file cannot be used by both processes at the same time, the logging appenders for the new w3wp may not initialize correctly, resulting in no further logging. For better visibility and clarity, I have raised the concern to Sitecore over a support ticket. Solution: The behavior I reported was registered as a bug in the Sitecore bug-tracking system. The bug specifically affects the log file appender after an application pool recycle, which happens afte...

Monitoring the Sitecore xDB Index Rebuild Process

Image
If you are using the SOLR search provider, to rebuild the request command we need to build the xDB index using the command manually from the xDB app service in Sitecore XP. You can find more details here: Invoke the rebuild request command Upon execution command, you get the following output: The index rebuild process takes time to complete and the request rebuild command does not provide any information about the progress status. However, there are certain ways you can monitor the state of an ongoing rebuild process. To Monitor the Index Rebuild Process: SOLR Interface: You can do so by running the following query by navigating to the original xDB Solr core and go to the Query tab. On the Query tab, insert the above into "q" part and click "Execute Query". Once executed, we should be able to see the result as such. In this example, the rebuild state is at 5 (Ongoing) and it is at 95%. ...

Sitecore Custom Language and SOLR Indexing Error

Image
Recently we have added the Korean language to our multilingual Sitecore website. As we know Sitecore automatically creates dynamic fields in the SOLR schema. But while publishing we found the following issue in our logs: Solution: The error is in sitecore_web_index and it seems we are missing a dynamic field for the Korean language. To solve this issue, we need to add the dynamic field in the SOLR schema file: <dynamicField name="*_t_ko" type=" text_general" indexed="true" stored="true" /> Restart the SOLR But take care that whenever you populate the managed schema from Sitecore, it will overwrite your managed schema, and you will lose all the changes. Another approach is to customize the SOLR schema using backend code. Step 1: Create a custom class and add the following logic: Step 2: Create one more class that inherits from IPopulateHelperFactory implement the ...

The Timeout was Reached Before the Message in Sitecore Redis

Image
While working on Sitecore PaaS you have a Redis issue. This time we have a Redis timeout issue but with a different message: Solution: After conducting research and using Google, I have discovered that there are 2 links from the above exception: https://stackexchange.github.io/StackExchange.Redis/Timeouts https://stackexchange.github.io/StackExchange.Redis/ThreadTheft I am experiencing the "thread theft" of the reader. The parameter "rs" in the error message tells me the state of the reader. If this is frequently reporting CompletePendingMessage , it is possible that the reader loop has been hijacked when trying to set results. It's further elaborated in the Thread Theft. To address this issue try adding the following early on in your application startup: ConnectionMultiplexer.SetFeatureFlag("preventthreadtheft", true); The issue is more related to the StackExchange.Redis commun...

Intermittent StackExchange.Redis.RedisTimeout Exception in Sitecore

Image
I was encountering frequent time-out issues with Redis and my application deployed on Azure PaaS. Following are the sample exceptions from logs: Solutions: I have reviewed config files from our CD server according to Sitecore's recommendation in this KB article here  Excessive load on ASP.NET Session State store , and checked some of the points. In the Web.config and Sitecore.Analytics.Tracking.config files, increase the pollingInterval attribute value on both Private and Shared session state provider definitions from 2 to 60 seconds. => For my case, the pollingInterval value is in the Sitecore.Analytics.Tracking.Azure.config file and the value is still 30. I have considered increasing the value further. In the Sitecore.Analytics.Tracking.config file, find the timeoutBetweenLockAttempts parameter. Increase its value from 10 to 200 milliseconds. => The value should be defined in the ...

Restart SOLR Managed Cloud Server

Image
If you are on Sitecore Managed Cloud and your SOLR is with Managed Cloud Server Searchstax then it is not easy to manage it. In today’s blog, I am going to discuss how to manage Managed Cloud SOLR Server, especially Restart SOLR. After successfully setting up Sitecore and SOLR instance by Sitecore, Sitecore provides you the URL of SOLR Server and the following details: Solr server connection string Solr server URL Zookeeper Ensemble API key Solr server user Solr server password To access the SOLR admin UI: Open the https://<server_name>-azure.searchstax.com/solr/ URL and enter the Username and Password. Get a List of Nodes: Before doing this exercise, you need to find the number of nodes in your SOLR server (a standard server consists of 3 nodes). For example, if your server_name provided by Sitecore is "ss123456" then ideally your nodes will be ss123456-1, ss123456-2, ss123456-3. By using the below URL, you can ...

IsLanguageFallbackValid Field Cache Tunning in Sitecore

Image
In continuation of the cache tunning, if your website is multilingual then you may need to tune the isLanguageFallbackValid field cache value. The initial thought was it could be tuned using the Small Cache Size as <setting name="Caching.SmallCacheSize" set:value="200MB" />  But "Caching.SmallCacheSize" no longer controls isLanguageFallbackValid due to a Feature Request with reference number 221831.  Starting with Sitecore 9.2, the cache size now depends on setting Caching.IsFallbackValid.DefaultCacheSize To find out about how to tune cache in Sitecore,  See the blog post- Cache Tunning in Sitecore To find out more about monitoring and tuning cache on CD Server, see the blog post- Monitor and Tune Cache on CD Server Happy Sitecoreing  ðŸ˜Š

Sitecore Installation Error Connection was Established but Error Occurred During Login

Image
While Installing the Sitecore 10.3 on my local machine (Windows 11), I encountered with the following error: The root cause of the issue is that a connection to the SqlServer is established without the "TrustServerCertificate" parameter. Solution: Go to the xconnect-xp0.json  in your Sitecore download setup files, open it in any editor tool, and search the following parameters: CreateShardApplicationDatabaseServerLoginInvokeSqlCmd CreateShardManagerApplicationDatabaseUserInvokeSqlCmd CreateShard0ApplicationDatabaseUserInvokeSqlCmd CreateShard1ApplicationDatabaseUserInvokeSqlCmd Add the "TrustServerCertificate": true , to all parameters. For example: Reference:  https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1003015 Happy Sitecoreing  ðŸ˜Š

Illegal Characters in Path Sitecore

Image
Instead of redirecting to the "Item Not Found" page, Sitecore may generate the following error messages when it receives a request containing Illegal characters in the path: Solution: I saw a similar issue and it could depend on the "requestPathInvalidCharacters" settings in <httpRuntime> in Web.config . Go to the web.config and search for httpRuntime node. Check if the requestValidationMode is there, if it is not then add the attribute requestValidationMode="2.0"   Make sure validateRequest attribute in the page node is set to false. <pages validateRequest="false"> If you want to add these characters to the path, add the requestPathInvalidCharacters attribute to the httpRuntime node. <httpRuntime targetFramework="4.8" ...... requestPathInvalidCharacters="&lt;,&gt;,*,%,&amp;,:,\,?"/> Reference: ...

Sitecore MCS Custom Backup Failed Due to Size Limit

Image
Sitecore Managed Cloud Service provides the default setting for the Custom Backup of our CD instance. In your environment, you can see all default settings from the Backup Action tab. As our custom backup had a limit of 10GB with a linked database of 4 GB so due to the size of the logs and other files we are sometimes getting failed custom backups. Automatic vs. Custom Backups Hence regarding your backup failures, that is mostly due to " The website + database size exceeds the 10 GB limit ". I did a quick check and it seems that the folder in site/wwwroot/App_Data/Logs is using up to 6GB of available space. To view the file usage of each folder, you can go to KUDU, open the PowerShell console, and run this command in the WWWroot: Solutions: Regarding the solution to the failed backups and why Sitecore prefers the use of Custom Backup as it supports. It is due to Partial backups being supported for custom backups. Partial b...

Error: Method Through Reflection is Not Allowed after Applying Sitecore Hotfix

Image
Recently, Sitecore security bulletin SC2023-003-587441 addresses Critical (582720) and High (584731) severity vulnerabilities in Sitecore software and provides the cumulative hotfix for the same. I have applied this hotfix in my solution and deployed it, but I have encountered the following error while publishing the Sitecore Items. If you are looking for how to install the Sitecore Cumulative hotfix OnPrem and PaaS instances, see the blog post: Sitecore Cumulative Hotfixes Installation on OnPrem and PaaS Solution: This Security Hotfix might add a security layer that prevents the execution of unexpected methods through reflection. As I have customized the publishing method for Sitecore items, I am getting this issue while publishing the Sitecore items. Go to the path " \App_Config\Sitecore\CMS.Core\ " and open the " Sitecore.Reflection.Filtering.config " file. Add the method name to the " Sitecore.Reflect...

Sitemap and Robots in Sitecore Multisite

Image
In the continuation of my previous blog Steps to be Performed after Multisite Configuration, I am going to discuss two important functionalities in terms of Google search crawling ranking and every website core functionality which are Sitemap and Robots txt implementation.  Create a new Template with two fields Sitemap and Robots. Inherit the above template on the Home page template of both Site nodes. Create a patch file: This patch file will have one pre-processor to allow the URL extension for XML and Txt files and another processor in the httpRequestBegin pipeline to serve Sitemap and Robots txt files. Create a class in your project for the custom processor and use the below code Deploy your application and browse pages: Website-a.com/sitemap.xml Website-b.com/sitemap.xml Website-a.com/robots.txt Website-b.com/ robots.txt If you want to implement the same functionality using A...

Sitecore - Value Cannot Be Null Parameter Name Key

Image
After upgrading the solution to Sitecore version 10.2, I have started facing the Value that cannot be a null error. More details log and error you can find below: After investigating this issue, I have found that this is a known issue in Sitecore and Sitecore described the solution here Retrieving the child items of resource items is not thread-safe . But as we were on Sitecore XM instead of the XP version, so will it work for XM? Yes, the cumulative hotfix works for XM as well, so do not be confused with it. Note: This hotfix is a Cumulative hotfix and does not use the installation wizard to install it. Such hotfixes are not intended to be installed using the Installation wizard. Instead, you need to refer to the following articles describing by Sitecore, how to install the hotfixes for OnPrem and PaaS instances: Install a Sitecore XP pre-release using SIF Deploy a Sitecore XP pre-release to a PaaS solution But I h...

Sitecore Cumulative Hotfixes Installation on OnPrem and PaaS

Image
In this blog post, I will discuss how to install the cumulative hotfix on Sitecore OnPrem and PaaS instances. For example, Sitecore provided the Cumulative hotfix for Sitecore XP 10.2  and it's available for both XM and XP 10.2 instances. Usually, to install the hotfix we use the Sitecore installation wizard, but such cumulative hotfixes are not intended to be installed using the Installation wizard. Instead, we need to refer to the following articles describing how to install the hotfixes for OnPrem and PaaS instances: Install a Sitecore XP pre-release using SIF Deploy a Sitecore XP pre-release to a PaaS solution My application has been deployed with Sitecore Managed Cloud Service (Azure PaaS) . I have found that there is less instruction about how to install the cumulative hotfix, so I decided to install it via project solution. Solution: Create one separate project in your solution named SitecoreHotfix...

Log Search Alert Rule Appeared in Azure Portal

Image
Over the weekend suddenly Log Search Alert Rule appeared on our UAT and PROD MCS Azure account dashboard and it’s not easy to find the actual app services. It has never existed before on Portal. These resources always existed but were hidden on the portal, to see it in the portal we had to check the "show hidden types" checkbox. But now these resources are visible by default, it looks like a recent change on the portal. Azure support has confirmed that this is the recent change on the portal. The Azure team has made rules and action groups a first-class asset, official documentation will follow. We are still in contact with them on the matter of question if it's still possible to hide them as before. The solution is adding specific tags to resources and then filtering by the tags in the Azure portal, below are the steps describing how to do it: Assign Tags for the resource (Alert rules/Action Group), filter the Type with a t...