Experience Sitecore ! | All posts tagged 'Troubleshooting'

Experience Sitecore !

More than 300 articles about the best DXP by Martin Miles

Troubleshooting SitecoreAI Page Builder Stuck Forever on the Loading Spinner

Have you experienced that at least once? You open a page in SitecoreAI Page Builder, the page itself visually loads inside the editor iframe, you can clearly see the website content, but the editing UI never becomes available. Instead, the ng-spd-loading-indicator remains on top forever, blocking any interaction with the page.

That is a frustrating one, because at first sight the rendering host seems to work. The page is not blank. The app does not completely crash. There is no obvious "rendering host is unavailable" message. You may even see only one unrelated-looking browser console error, for example, something like a duplicate third-party script initialization.

In my case, the visible symptom was exactly that: Page Builder loaded the page content, but the Sitecore loading overlay never disappeared. The same fix had to be applied and verified on DEV, UAT, and PROD, with slightly different deployment mechanics per environment.

Let's walk through the troubleshooting route from the first false assumptions to the final fix.

Something to start with ...

Before digging into implementation details, it is worth refreshing how Page Builder rendering is supposed to work in XM Cloud / SitecoreAI.

The most important references are:

The key thing to remember is that Page Builder does not simply browse your public website. It talks to a rendering endpoint, typically:

https://<editing-host-or-rendering-host>/api/editing/render

That endpoint validates the editing secret, extracts Sitecore editing parameters, fetches editing layout data, renders the page with metadata, and returns markup that Page Builder can understand.

That "with metadata" part is important. A page that visually renders as a website is not automatically a page that Page Builder can edit.

What I First Suspected

When Page Builder hangs with a spinner, there are many tempting directions to investigate first. Some of them are absolutely valid in different cases.

1. Broken Rendering Host Configuration

The first obvious suspect is the rendering host item under:

/sitecore/system/Settings/Services/Rendering Hosts

For metadata-based editing, the important fields are:

Server side rendering engine endpoint URL:
https://<host>/api/editing/render

Server side rendering engine application URL:
https://<host>/

Server side rendering engine configuration URL:
https://<host>/api/editing/config

If these are wrong, Page Builder may fail early. In my case they were not the main reason, but they are still always worth checking.

2. Missing Environment Variables

The next suspect is environment configuration. The editing host and external rendering hosts need the right variables for Preview context and editing:

SITECORE_EDGE_CONTEXT_ID
NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID
NEXT_PUBLIC_DEFAULT_SITE_NAME
SITECORE_EDITING_SECRET

If one of those is missing, the render endpoint may return 401, 404, or 500 depending on where the application fails. I did find environment differences during the overall investigation, but fixing variables alone was not sufficient for the spinner problem.

3. Content, Presentation Details, or Personalization

Because the page content appeared in the iframe, it was natural to suspect some content-level issue:

  • broken final/shared presentation
  • component throwing only in edit mode
  • datasource item missing in Preview
  • personalization rule breaking layout service output
  • page relying on a rendering that does not support metadata

Those issues can absolutely break Page Builder. However, in this case the same application-level behavior appeared across pages and environments, which made a single content item less likely.

4. Experience Edge, Publishing, Indexing, or Links Database

Another direction is backend state:

  • item not published to Edge
  • stale Edge cache
  • index not rebuilt
  • links database not rebuilt
  • bad page route resolution

These are valid checks for missing content on a public site. But Page Builder editing uses Preview context and editing layout data. A public rendering problem and an editing render problem may look similar in the browser, but they are not the same thing.

5. Browser Console Errors

There was also a console error about duplicate initialization of a third-party SDK. It looked suspicious, but it was not the blocker. This is a good reminder: browser console noise is useful, but do not let the loudest warning own the investigation.

The Actual Symptom to Focus On

The important symptom was not simply "the page does not load".

The more precise symptom was:

The page content renders, but Page Builder never receives the successful editing-render completion it expects, so the ng-spd-loading-indicator never goes away.

This distinction matters a lot.

If a page is fully broken, you usually chase a rendering exception. If the page renders but Page Builder cannot edit it, you need to inspect the editing render flow.

The critical request is:

/api/editing/render

That is the request Page Builder makes to get editable metadata-backed markup.

How the Render Flow Is Supposed to Work

With Content SDK and Next.js, Page Builder calls the render API route with parameters similar to:

/api/editing/render
  ?secret=<editing-secret>
  &sc_site=<site-name>
  &sc_itemid=<item-id>
  &sc_lang=en
  &route=/
  &mode=edit
  &sc_version=latest
  &sc_layoutKind=shared

The SDK render middleware then:

  1. Validates the editing secret.
  2. Extracts the editing parameters.
  3. Enables preview/editing mode.
  4. Calls back into the application to render the requested page.
  5. Returns HTML that includes the metadata Page Builder needs.

That callback into the application is where this case became interesting.

The application was using App Router with a multisite route shape:

/{site}/{locale}/[[...path]]

The normal page route worked perfectly for public traffic. But for Page Builder, the default render handler was not explicit enough. The internal editing render request was going through the normal routing and middleware chain instead of a dedicated editing route.

That created a half-broken experience:

  • the page could visually render
  • middleware and routing still interfered with the editing request
  • Page Builder did not receive exactly the response it needed
  • the spinner never disappeared

The Fix: Create a Dedicated Editing Render Page

The fix was to stop sending the SDK render handler back through the normal public route and give Page Builder a dedicated private route for editing render.

The render API route changed from this:

import { createEditingRenderRouteHandlers } from '@sitecore-content-sdk/nextjs/route-handler';

export const { GET, POST, OPTIONS } = createEditingRenderRouteHandlers({});

to this:

import { createEditingRenderRouteHandlers } from '@sitecore-content-sdk/nextjs/route-handler';

export const { GET, POST, OPTIONS } = createEditingRenderRouteHandlers({
  allowedQueryParams: ['secret'],
  resolvePageUrl: () => '/sitecore-editing',
});

That tells the SDK:

  • preserve the secret query parameter
  • render editing requests through /sitecore-editing
  • do not guess the public page URL for the internal request

Then I added a private App Router page:

src/app/sitecore-editing/page.tsx

Its job is not to serve public traffic. Its job is to render a Sitecore page in editing mode after the SDK has transformed the original sc_* query parameters into the editing request.

The page does three important things.

First, it validates the request:

const CONTENT_SDK_PREVIEW_HEADER = "__content_sdk_preview";

if (
  !editingPreviewData ||
  requestHeaders.get(CONTENT_SDK_PREVIEW_HEADER) !== "1" ||
  secret !== scConfig.editingSecret
) {
  notFound();
}

Second, it constructs the editing preview data:

return {
  site,
  itemId,
  language,
  mode: mode === "edit"
    ? LayoutServicePageState.Edit
    : LayoutServicePageState.Preview,
  variantIds: getSearchParam(searchParams, "variantIds") || DEFAULT_VARIANT,
  version: getSearchParam(searchParams, "version"),
  layoutKind: getSearchParam(searchParams, "layoutKind") as LayoutKind | undefined,
};

Third, it fetches Sitecore preview data instead of public page data:

const page = await client.getPreview(editingPreviewData);

After that, it renders the same layout and providers as the normal public page. The difference is that the data source is now the editing preview data, and the route is isolated from public routing behavior.

Do Not Forget Middleware

This was the other important part.

If the application has middleware for multisite routing, localization, redirects, personalization, authentication, language cookies, or anything similar, that middleware may intercept /sitecore-editing.

For public traffic that is normal. For the internal editing render request, it is dangerous.

So the proxy/middleware needs to bypass this route:

export async function proxy(req: NextRequest, _ev: NextFetchEvent) {
  const langCookie = req.cookies.get(LANG_COOKIE_NAME)?.value;
  const pathname = req.nextUrl.pathname;

  if (pathname === '/sitecore-editing') {
    return NextResponse.next();
  }

  // normal middleware logic follows
}

That one small bypass is the difference between "the route exists" and "the route is actually usable by the editing render pipeline".

How I Verified the Fix

There are a few useful checks that do not require opening Page Builder first.

1. Check the Render API Route

The render endpoint should answer OPTIONS:

curl.exe -sS -o NUL -D - -X OPTIONS https://<host>/api/editing/render

A good response is:

HTTP/1.1 204 No Content
X-Matched-Path: /api/editing/render

That confirms the route exists on the deployed host.

2. Check the Private Editing Route

Direct browser access to /sitecore-editing should not show the page. It should be protected:

curl.exe -sS -o NUL -D - https://<host>/sitecore-editing

Expected result:

HTTP/1.1 404 Not Found
X-Matched-Path: /sitecore-editing

This is a very useful result. It means the route is deployed and matched, but the security checks are working because the direct request does not include the internal preview header and secret.

3. Check the Actual Page Builder Network Flow

After that, open Page Builder and watch the Network tab.

The request to /api/editing/render should complete. If it returns a normal error, troubleshoot that error. If it returns an HTML page that looks like a public route, check that resolvePageUrl is actually pointing to /sitecore-editing and that middleware is not rewriting it.

Deployment Gotchas Across DEV, UAT, and PROD

The code fix was the same, but deployment was not.

In DEV, the application branch already contained the shared render helper, so the fix was straightforward and went through the development branch.

In UAT, the same fix had to be deployed both to the Sitecore editing host and the external Vercel rendering host, because Page Builder may use either depending on the rendering host item configuration.

In PROD, there was an additional twist: the production editing host was tied to main, not the development branch. Therefore, blindly pushing the full development branch would have been wrong. The fix had to be backported narrowly to main, including only:

src/app/api/editing/render/route.ts
src/app/sitecore-editing/page.tsx
src/proxy.ts

Then the production editing host was deployed from main, and the production Vercel projects were deployed manually because Git deployments were disabled for those projects.

That is another important lesson: when fixing Page Builder, do not assume the public rendering host and the Sitecore editing host are deployed by the same mechanism. Check both.

The Minimal Checklist

If I had to reduce the whole troubleshooting route to a checklist, it would be this:

  1. Confirm Page Builder is failing at the editing render stage, not just public page rendering.
  2. Check /api/editing/render on the host configured in Sitecore.
  3. Confirm the rendering host item points to the metadata endpoint, not an old /jss-render endpoint.
  4. Confirm SITECORE_EDITING_SECRET and Edge preview variables exist on the host.
  5. Check whether App Router, middleware, redirects, localization, or multisite proxy logic intercepts editing requests.
  6. Add a dedicated /sitecore-editing route for App Router editing render.
  7. Point createEditingRenderRouteHandlers to that route with resolvePageUrl.
  8. Bypass middleware for /sitecore-editing.
  9. Deploy both the Sitecore editing host and any external rendering host Page Builder may use.
  10. Verify OPTIONS /api/editing/render and protected direct access to /sitecore-editing.

Final Thoughts

This problem is confusing because it does not look like a classic crash. The site renders. The content is visible. The browser may even show unrelated console errors. But Page Builder is still blocked because visual rendering is only half of the contract.

For SitecoreAI Page Builder, the rendering host must return an editing-aware, metadata-enabled response. With Next.js App Router and custom middleware, the safest approach is to give the SDK render handler a dedicated private route and keep that route out of the normal public routing pipeline.

Once that was done, the spinner disappeared and the editing experience started behaving normally across the environments.

Sometimes the fix is not in the component that appears broken, nor in the content item being edited. It is in the invisible bridge between Page Builder and the rendering host.

Resolving broken images issue on XM Cloud starterkit running in local containers

A guide on how to resolve the media problem with the default vanilla StarterKit (foundation head) when images do not show on a site when accessed by a hostname.

Reproducing the problem

  1. Pull the latest starter kit, run init.ps1 , and up.ps1 as normal. Everything is fresh and clean; nothing else than that.
  2. When CM spins up, create a site collection followed by a site with the default name (nextjs-starter) matching the name of the JSS app.
  3. Open the home page in Experience Editor and drop an Image component to that page, upload and choose the image, save, and confirm it looks fine in EE.
  4. Open the home page again on the site: https://nextjs.xmc-starter-js.localhost and see the error

The error

Invalid src prop (https://cm/-/jssmedia/Project/Tenant/Habitat/LA.jpg?h=408&iar=0&w=612&ttc=63890432287&tt=4BBE52A4592C2DBCAE59361096C0E4D3&hash=0CA75E384F533EE5539236785DCF0E22) on `next/image`, hostname "cm" is not configured under images in your `next.config.js`

What happens?

The hostname of a local CM container is applied to the generated media URL (https://cm). That is not right, as CM hostname is not accessible outside of containers, and only works within the internal Docker network at the HTTP protocol, not HTTPS. After playing with the image URL, it was clear it works by a relative path, trimming the hostname from the start. Both URLs below are valid and show the image:

Testing an assumption

I thought if there was a problem on the datasource resolver of the Image component, but the resolver wasn't set. Just for the sake of experiment, decided to explicitly set image component to use `/sitecore/system/Modules/Layout Service/Rendering Contents Resolvers/Datasource Resolver`, since it has the same effect as when not set, along with unchecking Include Server URL in Media URLs settings for that resolver.

And on the resolver, unchecking as below:

That effectively resolved the issue. My guess was valid, so let's now seek a permanent solution.

The working solution

Once the assumption of removing a hostname is proven, let's take it out at the CM level so that it universally applies to your environments and you don't need to precisely set resolvers on each individual component. The below config patch does exactly what we need.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
  <sitecore>
    <layoutService>
      <configurations>
        <config name="sxa-jss">
          <rendering>
            <renderingContentsResolver>
              <!-- Set the desired values for the JSS configuration -->
              <IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
            </renderingContentsResolver>
          </rendering>
        </config>
      </configurations>
    </layoutService>
  </sitecore>
</configuration>

That resolved my problem: the desired image loaded well.

Hope this helps you as well!

Troubleshooting SXA "Failed to render rendering. Message: An unhandled exception occurred. Source: Sitecore.Mvc"

Got a weird exception, very similar to the one described at StackExchange (SXA Error when open page in Experience Editor). It happened at my CI server, so decided to reproduce locally, deploying on top of a clean instance of Sitecore, and got an issue reproduced.

Here's a call stack:

17264 22:03:56 ERROR Failed to render rendering
Exception: System.Web.HttpUnhandledException
Message: An unhandled exception occurred.
Source: Sitecore.Mvc
   at Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage.ShowErrorMessage(ExceptionContext exceptionContext, ExceptionArgs args)
   at Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage.Process(ExceptionArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Mvc.Filters.PipelineBasedRequestFilter.OnException(ExceptionContext exceptionContext)
   at System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
   at System.Web.Mvc.Controller.ExecuteCore()
   at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
   at Sitecore.Mvc.Controllers.ControllerRunner.ExecuteController(Controller controller)
   at Sitecore.Mvc.Controllers.ControllerRunner.Execute(TextWriter writer)
   at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)

Nested Exception

Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.XA.Foundation.Grid
   at Sitecore.XA.Foundation.Grid.Commands.ShowGridPropertiesDialog.QueryState(CommandContext context)
   at Sitecore.Shell.Framework.Commands.CommandManager.QueryState(Command command, CommandContext context)
   at Sitecore.Pipelines.GetChromeData.GetChromeDataProcessor.QueryButtonState(WebEditButton button, CommandContext context, String click)
   at Sitecore.Pipelines.GetChromeData.GetChromeDataProcessor.AddButtonToChromeData(WebEditButton button, GetChromeDataArgs args)
   at Sitecore.Pipelines.GetChromeData.GetChromeDataProcessor.AddButtonsToChromeData(IEnumerable`1 buttons, GetChromeDataArgs args)
   at Sitecore.Pipelines.GetChromeData.GetRenderingChromeData.Process(GetChromeDataArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Pipelines.GetChromeData.GetChromeDataPipeline.Run(GetChromeDataArgs args)
   at Sitecore.Mvc.ExperienceEditor.Presentation.RenderingMarker.GetClientData()
   at Sitecore.Mvc.ExperienceEditor.Presentation.RenderingMarker.get_ClientData()
   at Sitecore.Mvc.ExperienceEditor.Presentation.RenderingMarker.GetStart()
   at Sitecore.Mvc.ExperienceEditor.Presentation.Wrapper..ctor(TextWriter writer, IMarker marker)
   at Sitecore.Mvc.ExperienceEditor.Pipelines.Response.RenderRendering.AddWrapper.Process(RenderRenderingArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Mvc.Helpers.SitecoreHelper.RenderPlaceholderCore(String placeholderName, TextWriter writer)
   at Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName)
   at ASP._Page_Views_Shared_Partial_Design_Dynamic_Placeholder_cshtml.Execute() in c:\inetpub\wwwroot\RssbPlatform.dev.local\Views\Shared\Partial Design Dynamic Placeholder.cshtml:line 5
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)

No single reference to my code, or whatsoever prompting to the actual reason.

Troubleshooting this was not an easy walk out. Logs also contained nothing relevant to the issue. Since I always keep at least daily backups done with a helpful tool Sif0n, it was relatively easy to substitute a web root folder from a fully functional solution. but the problem persisted. Then it is likely to be caused by something stored in a database.

I suspected something could be wrong with my serialization, I checked the settings but those were all correct. Then I restored fully functional database along with existing instance, calling it master_OK and started comparing those items one by one. And finally, I found the difference:


Reason for error: Rendering parameters template was missing due not being serialized and synced on that new environment. How could that happen? Don't know for sure, but a very alike suspect is that when using a clone rendering SXA script I accidentally missed out secondary options, so that script cloned rendering parameters for a new rendering, but left it underneath Experience Accelerator folder. Which is kept outside of serialization (as I more or less correctly predicted at the beginning of my investigation). So rendering parameters template was referenced, but did not exist on the target system. 

After fixing it, the site worked well. I do understand that the call stack I included above and the error messages are quite generic and may be met but any other scenarios, so probably Sitecore needs to assert and explicitly log such errors. At least I shared the way of dealing with it and my exact reason with you, hope it may help someone.

Troubleshooting Solr populate schema for Sitecore Commerce 9.0 update 3 installation

I was installing Sitecore Commerce 9.0 update 3 and after a long successful run, it broke out with an error saying that Solr fails to populate schema.
After digging out, I found out that this issue is coming from Sitecore-commerce-solr.json has capitalized argument Name that is further concatenated with other arguments into a URL: 

https://localhost:8983/solr/admin/cores?action=Create&Name=platformCustomersScope&Configset=basic_configs&wt=json

where it should be with lower case 'n' instead:

https://localhost:8983/solr/admin/cores?action=Create&name=platformCustomersScope&Configset=basic_configs&wt=json

As I later cleared up from Sitecore, the issue comes from using SIF 2.0 for installing XC 9.0 update 3, which is not supported -we should use SIF 1.2.1 instead. However, changing these configuration json file arguments to lowercase make the trick work.

Mythical SXA body-top placeholder shown in Experience Editor

Recently I came into a weird situation. So, to start with ...

I got Sitecore 9.0 update 2, installed SXA 1.8 for 9.0 on top of it. Created a tenant and a site, also made few pages for test and some initial settings as we usually do as per documentation, so far so good. 

Then I made a solution, configuration and serialized everything I made on the previous step, then reinstalled an instance in order to test my solution, configuration and serialization deploys well on top of clean Sitecore and to confirm everything works as expected.

Build process went fine, deployment worked well, Unicorn ran and created the site with all my pages and all relevant items - all good, except for one issue. Before Sitecore reinstallation, a new page in Experience Editor looked that way:


After the deployment on top of the new clean instance, running Experience Editor brought the following layout:


Clearly, there was something missing from either my configuration or serialization. So I started troubleshooting and comparing.

In both scenarios, I had instances sites of the same version and both with SXA 1.8. Since this issue was reproducible, next time I made git init just within webroot in order to get a version diff with a post-deployment state, so that I could see all modified files and see the diff as I usually do with git tools. However, nothing suspicious found at bin and within App_config folder. Deployment went as expected so that should be something in Sitecore then.

First of all, I compared templates and standard values, but they were the same for both cases. Next, I ensured presentation details are also identical, even ensured Layout files and binary equal.  Yes, it contains body-top placeholder, but in one scenario it is presented for some reason.

Then I went to the actual page items in order to compare those, but they were also the same. View options have same parameters checked. No idea then...

Finally, after spending plenty of time I figured out that something was wrong with SXA themes. Unfortunately, did not identify what exactly causes the problem, but after re-creating it at serialization config and re-serializing items the issue has gone. So, the outcome is: if you see unexpected placeholders - please make sure your SXA theme is in the correct state and serialized properly.

Fixing issues preventing one having solution with SXA 1.8 along with Sitecore XP 9.0 update 2

I was very anticipating to upgrade my solution to recently released XP 9.1 with SXA 1.8 and all its great features, however, I got a dependency on Sitecore Commerce, which hasn't (yet) updated to 9.1. Got nothing to do with that, but just wait for a month or so until XC 9.1 is out...

But wait, why not just update at least SXA to version 1.8 meanwhile? SXA 1.8 comes for both versions for 9.1 and 9.0 which means - in two runtimes .NET 4.7.1 and .NET 4.6.2 correspondingly. Done, upgraded. SXA 1.8 works well on top of clean Sitecore 9.0 update 2 instance for me.

But when it came to updating NuGet packages in my solution, I was unable to do so because NuGet packages for my version for some reason demand .NET 4.7.1:


And that is my error:

Package Sitecore.XA.Feature.CreativeExchange 3.8.0 is not compatible with net462 (.NETFramework,Version=v4.6.2) / win-x86. Package Sitecore.XA.Feature.CreativeExchange 3.8.0 supports: net471 (.NETFramework,Version=v4.7.1)


Version 3.8.0 is the correct version of SXA 1.8 for 9.0 and it should support .NET 4.6.2, not 4.7.2. Version of SXA 1.8 for 9.1 has number 4.8.0 and that one indeed supports 4.7.1 runtime.

Since I cannot do anything about NuGet feeds, I turned back to the old lib\LocalRepository folder in my solution, simply copying all the required SXA 1.8 libraries from instance webroot (where I have SXA 1.8 working with clean 9.0 update instance) and referencing them instead from affected projects. 


That did me a job for the moment. I will either update to the NuGets once it is fixed with the correct version or upgrade the entire solution to 9.1 when XC 9.1 is out, whatever comes earlier.

Troubleshooting Sitecore Commerce 9 installation

While installing Sitecore Commerce I came across several blockers I had to sort out in:

  1. SIF
  2. Business Tools
  3. Storefront

1. You are getting 500.19 error during SIF. Other people who came across advice that you are to install ASP.NET Core 2. That's correct, as Commerce micro-services utilize .NET core, but not everything. There was a strong assumption of something missing from IIS or being mis-configured, so in my case it was this component unchecked:


Also, keep in mind you must have URL-Rewrite module installed (the easiest way is: choco install urlrewrite).

Another non-critical error I am getting from time to time is "The service cannot accept control messages at this time". IIS does respond at the moment - you may run iisreset and try warm it up by hitting URL manually in browser. Then repeat SIF deploy.

If SIF is complaining about duplicate certificates, you may need to delete those from Microsoft Management Console (MMC). In order to do that, click Start button, then type in mmc and hit enter. Once there, File - Add/Remove Snap-ins and select Certificates, as on screenshot below:


One more error from SIF: "Error: Unable to add user SITECOREDEV\WindowsUserName. Details: Database 'sc902com_Core' does not exist. Make sure that the name is entered correctly." In that case, ensure you're referencing correct database name for SitecoreCoreDbName variable (line 29 of default deploy script)


2. Running Business Tools may bring an error. In some previous versions Business Tools desktop icon was referencing invalid port, so make sure it is 4200 (by default). You can do that by changing Link field for Business Tools launchpad icon, as you usually do in corу database (item path: /sitecore/client/Applications/Launchpad/PageSettings/Buttons/Commerce/BusinessTools)

While running Business Tools, if you may see to following error:


The error means your browser needs a security exception for self-signed certificate, no worries - that's only for localhost and needs to be done once. Just open a new browser tab and follow to localhost:5000, confirming security exception, as prompted.

3. Once you have successfully installed Sitecore Commerce, you try to access storefront. So you hit URL in browser (sxa.storefront.com) and ... see default Sitecore home page. Why?

The first assumption coming into one's mind is that since storefront is running on top of SXA - you should configure the hostname at HostName field of /sitecore/content/Sitecore/Storefront/Settings/Site Grouping/Storefront item. But wait! sxa.storefront.com is the default value and already presents there. Does it work now? Nope ...

Firstly, try open storefront in Experience Editor (from master database). If you see the right storefront - just re-publish site, and update indexes - it will work from web database then. But if not - the answer is different: it appeared that my current partner's license does not include SXA. Not obvious, but when you're out of license - storefront default to Home page rather than notify you re. that error.

Remember, that you may apply for a developer trial license valid for two month that will include all the features of Sitecore, including SXA and JSS.

Fixing: Sitecore 9 installer unable to connect to Solr server, while it is available

Recently tried to reinstall Sitecore 9.0 update 1 and got the following message:

"Request failed: Unable to connect to remote server" (and the URL which is default https://localhost:8389/solr)


Opening Solr in browser went well, and there were no existing cores that could prevent the installation. Weird...


After experiments, I found out that was an antivirus preventing such requests. Disabling it allowed cores to be installed well and thу rest of install script succeeded.

Get rid of IIS Express processes when debuggind Helix solutions

Problem: you are running a solution with a large number of projects (as we normally have with Helix) and willing to debug it. You are attaching to IIS process (from Debug menu of Visual Studio, or using magical hotkeys) but that takes way too much time to happen. You CPU usage increases and even likely to boost the cooling fans. Another thing you can evidence - slowly responding icon os IIS Express in the system tray:


What comes to one's mind as the first possible solution? To opt out of using IIS Express in favour of full local IIS, as soon as we are using it anyway to host our Helix-based solution. So you open up Web tab of Project Properties and indeed evidence that IIS Express is configured and has Project Url set to http://localhost with some specific long-digit port number:


Then expectedly you change it to Local IIS with Project Url having something similar to http://platform.dev.localwhere hostname for platform.dev.local already exists in your Windows hosts file as well as in IIS binding for that particular website, so that running this URL in a browser will, in fact, give you that locally running website. But you get a weird error instead:


Things are a bit worse, because if you deny creating a Virtual Directory, you'll get a message box as on the image below, and won't be able to close your project tab as it remains modified and will prompt you the same message again and again until you manually terminate devenv.exe process from Task Manager.



What happens? Something has alternative settings preventing you from changing to Local IIS. So need to find this out. After investigating a while I came across...

The solution contains two steps. Part one occurs because there is already a project extension file (ex. Sitecore.Foundation.Serialization.csproj.user) along with your actual project file, that extends (overrides) project settings. Normally, all *.user files are excluded from a source control so your colleague may not experience that same problem despite running the same code from the same repo branch. What exactly prevents you from saving Local IIS changes is UseIISExpress setting, so change it to false:

<PropertyGroup>
  <UseIISExpress>false</UseIISExpress>
</PropertyGroup>

Or just delete it - then settings from actual *.сsproj file will take effect, but as soon as you somehow customise your project, even as little as just clicking "Show All Files" button in the Solution Explorer - then *.user file will be immediately created. So let's move to the second part of this exercise. Now we need to change actual project to use Local IIS. Make sure you set already familiar UseIISExpress property to false

<PropertyGroup>
  <UseIISExpress>false</UseIISExpress>
</PropertyGroup>
and also specify Local IIS to false, CustomServerURL to true with the correct URL where your site is running:
<UseIIS>False</UseIIS>
<UseCustomServer>True</UseCustomServer>
<CustomServerUrl>http://platform.dev.local</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
So now all works. It loads correctly and you can modify and save Web tab of Project Properties without anу issues:


Also, if you already have virtual folders created under your IIS website, make sure they are removed and the website itself contains the right web folder path:


That's it. Please also pay attention to applicationhost.config file that resides under \.vs\config folder in order to be picked by IIS Express. You may delete it without any potential damage, as we just got rid of IIS Express.

Hope this helps!