Sitecore, XM Cloud

Quick fix: Lost content/renderings/templates in XM Cloud instance

Verify your serialized Sitecore item .YAML files are valid or not by pushing the serializations to local before deploying the solution to XM Cloud instance.

BEST PRACTICE FOR XM CLOUD

Recently we encountered the issue which put everyone on high heart beats when we learned that our XM Cloud instance which is getting prepared for PRODUCTION go live lost everything and we see vanilla Sitecore contents only in the Content Editor.

Everyone started looking for the issue caused and finding the culprit. We looked for Sitecore logs, deployment logs, code committed, etc.

We also raised the Sitecore support ticket as the environment we lost content for is going to be used for live website.

We again started looking at logs starting from Sitecore logs. There we find nothing special in the logs. Then we looked into the Deployment logs and few lines in the log drew our attention for.

As shown in the following image, there is an invalid YAML file for one for the serialized item.

While discussing about the issue with team members, we came to know that during the PR merge they faced the merge conflict issue. They fixed the merge conflict and deployed the changes to the XM Cloud instance which broke everything and turned the working instance into vanilla XM Cloud instance.

After fixing the issue and restoring the environment back to working state, we did retrospect our deployment process and found some drawbacks.

One of the important steps of pushing serialized items after merging the changes from one branch to another was not followed before triggering the XM Cloud deployment.

Now let us see how we can identify such error early before deployment.

If you are using XM Cloud Deploy apps, before making pull-request, or after resolving merge conflicts, validate your serialized items using following command.

dotnet sitecore ser validate

If you are using AzureDevOps or other CI/CD tool, add the following command before starting XM Cloud deployment.

dotnet sitecore ser validate

    I hope you will find this blog useful.

    Happy Sitecore + XM Cloud working!!!