Sitecore XM Cloud experience and some common issues and the solution
Hi guys,
I have recently done some deep dive into the Sitecore XM cloud. It went really smooth. There are couple of issues i like to point out here as it’s pretty common
Issue 1: Rendering host container is unable to start:
It’r pretty common to have an issue like above. The log might say: “npm is not recognized as an internal or external command”. Surely, it’s an npm issue and it seems like node was not installed. If you inspect the docker-compose, you would see rendering host has a dependency to node container. Then what’s the issue? Well, its’ actually the node version. For my scenario, i have changed the default version that came out with Sitecore xm cloud repo set up to “16.15.1”.
Issue 2: Creating a jss sxa site:
Once you successfully run the docker container for XM cloud, you would notice that there is headless site. Basically the default Sitecore website is there. You first need to create a headless site so that you can run the JSS app (rendering). When you create the site, make sure you name it: “sxastarter”. This way, you would not require any addtional changes and you should see the headless site working without any issues. But it’s not practical to use that name always. In that case, try to change that above app name from your rendering host app (package.json and any other places where it’ referencing)
Issue 3: Image is not loading in rendering host:
This one is pretty common. You would see that your app is running fine in Experience Editor but not inside the Rendering host. Some of those images are not loading. The fix for that is to make sure media item doesn’t use append the server url.
The easiest way to patch that is as below:
<layoutService>
<configurations>
<config name="default">
<rendering>
<renderingContentsResolver>
<IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
</renderingContentsResolver>
</rendering>
</config>
<config name="jss">
<rendering>
<renderingContentsResolver>
<IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
</renderingContentsResolver>
</rendering>
</config>
<config name="sxa-jss">
<rendering>
<renderingContentsResolver>
<IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
</renderingContentsResolver>
</rendering>
</config>
</configurations>
</layoutService>
</sitecore>
Issues 4: There is no publish target for Web:
When you try to publish some items, you might see error saying some configuration is missing for Edge. That’s because, it is trying to use Sitecore Experience Edge server to publish your items. For this, you need to make sure you have right configuration in place.
The other option is to create a web target as below. That way, you would still publish your changes to web db (later you can enable the edge and publish your content in there)
That’s all for today.
Cheers
Arif
Senior solution architect
Sitecore.