Troubleshooting SCCH

Version: 5.2

This topic contains ways to solve problems you might encounter in the Sitecore Connect for Content Hub (SCCH) connector.

General troubleshooting help

To help find solutions for errors or problems in general, you can do the following:

  • Check the log in the Sitecore Content Hub for the created trigger. Trigger the event that fires the trigger and then check the log as follows:

    • On the menu ribbon, click Manage.

    • Click Actions.

    • Click the Auditing tab.

  • Check posted messages in the Azure Service Bus.

  • Check the Sitecore log file and scan for any CMP or DAM related errors.

NullReferenceException occurs in the GetLabels method on CD server

The web database patch used to configure Sitecore Connect for Content Hub on the Content Delivery (CD) server contains a role:required parameter that must be removed.

To fix this issue, make the following configuration change:

  1. On the Content Delivery (CD) instance, open the \App_Config\Modules\Sitecore.Connector.ContentHub.DAM\Sitecore.Connector.ContentHub.DAM.config file (default file path).

  2. In the configuration file, find the following node:

    RequestResponse
    <database id="web"
     type="Sitecore.Data.DefaultDatabase, Sitecore.Kernel"
     role:require="!ContentDelivery">
  3. Remove the following role parameter from the database id node:

    RequestResponse
     role:require="!ContentDelivery"
  4. Save your changes.

  5. Restart the CD server.

You browse a Sitecore DAM image field type link, and you get a 404 not found error.

To solve this problem:

  1. In the Sitecore Launchpad, click Desktop, and switch from Master database to Core database.

  2. In the Content editor, navigate to sitecore/system/Field types/Simple types/Image.

  3. On the Content tab, in the Data section, clear the Control field. Save the item.

The connector does not change any data values or formats when it syncs data from the Content Hub rich text editor field to the Sitecore rich text editor. The XHTML validation in the Sitecore rich text editor might highlight the error:

XHTML validation error about incorrect formatting attributes in the Sitecore rich text editor

To solve this problem:

  1. In the Content editor, look for the following items:

    • /sitecore/system/Settings/Validation Rules/Field Types/Rich Text

    • /sitecore/system/Settings/Validation Rules/Global Rules

  2. For all validation rules under these two items, in the Selected list, click Is Xhtml to move it to the All list.

    Dialog for adding validation rules to items
  3. Save the items.

Azure deployment throws the error Could not load file or assembly 'Microsoft.Extensions.Caching.Abstractions' error

The Sitecore Azure ToolKit (SAT) is missing some references to required dependencies to perform the config transformation.

After you have applied the SCCH package to the instance, the bin\scch folder has all the required assemblies.

To solve the problem:

  1. In the Azure App Service Editor, open the Web.config file.

  2. In the assemblyBinding node, add the following code:

    RequestResponse
    <dependentAssembly>
        <assemblyIdentity name="Microsoft.Extensions.Caching.Abstractions" publicKeyToken="adb9793829ddae60" />
        <bindingRedirect oldVersion="0.0.0.0-3.1.14.0" newVersion="3.1.14.0" />
        <codeBase version="2.1.2.0" href="bin/Microsoft.Extensions.Caching.Abstractions.dll" />
        <codeBase version="3.1.5.0" href="bin/Microsoft.Extensions.Caching.Abstractions.dll" />
        <codeBase version="3.1.14.0" href="bin/scch/Microsoft.Extensions.Caching.Abstractions.dll" />
    </dependentAssembly>
  3. Save and refresh the Azure App Service Editor.

When searching for a CMP item with an Entity Identifier field value containing an hyphen (-), the CMP index processor creates a clone of the CMP item. As a result, 2 CMP items with the same Entity ID exist in the CMP item bucket.

To avoid this issue, you must change the search query $"{fieldValue}" in the SearchItemUnderItemBucket function from the Sitecore.Connector.CMP.Helpers.SitecoreHelper class, and implement a search query wrapper, such as: $"\"{fieldValue}\"".

To change the search query, you can patch the SitecoreHelper class using method override and dependency injection override mechanisms:

  1. Create a new class called SitecoreHelperExtend to override SitecoreHelper, and override the existing SearchItemUnderItemBucket function with the query wrapper changes:

    For example:

    RequestResponse
    public override bool SearchItemUnderItemBucket(string fieldName, string fieldValue, Item itemBucket, out ID itemId)
       {
        Assert.IsNotNull(fieldValue, $"Could not get the {fieldName}.");
        using (var context = ContentSearchManager.GetIndex(new SitecoreIndexableItem(itemBucket)).CreateSearchContext())
            {
              SearchResultItem resultItem = context.GetQueryable<SearchResultItem>().FirstOrDefault(
                    searchResultItem => string.Equals(
                        searchResultItem[fieldName],
                        $"\"{fieldValue}\"",
                        StringComparison.Ordinal)
                        && searchResultItem.Paths.Contains(itemBucket.ID));
                      if (resultItem == null)
                     {
                         itemId = ID.Null;
                         return false;
                     }
                       itemId = resultItem.ItemId;
                       return true;
              }
          } 
  2. Create a new ServiceConfiguratorExtend class for SitecoreHelperExtend:

    RequestResponse
    public class ServicesConfiguratorExtend : IServicesConfigurator
       {
          public void Configure(IServiceCollection serviceCollection)
            {
               serviceCollection.AddSingleton<SitecoreHelper, SitecoreHelperExtend>();
            }
       } 
  3. Open the Sitecore.Connector.CMP.config file and, in the service configurator node, add the new dependency injection (DI) service configurator:

    RequestResponse
    <services>
     <configurator type= "Sitecore.Connector.CMP.DI.ServicesConfigurator, Sitecore.Connector.CMP"/>
     <configurator type= "Sitecore.Connector.CMP.DI.ServicesConfiguratorExtend, Sitecore.Connector.CMP.Extend"/>
     </services> 

On-prem deployment throws Method does not have an implementation error

The Content Hub SDK in SCCH 5.0 requires Microsoft.Extensions.DependencyInjection version 3.1.14.0. For deployments on Sitecore 10.1.x and earlier that reference earlier versions, you must do one of the following:

  • Update and rebuild any custom assemblies to refer to version 3.1.14.0.

  • Add a redirect binding configuration in the web.config file.

On-prem deployment throws Method implementation missing error in Microsoft.Extensions.DependencyInjection or DisposeAsync method error

For Sitecore deployments prior to 10.2, custom assemblies must refer to the latest Microsoft.Extensions.DependencyInjection version 3.1.14.0, as SCCH 5.0 requires version 3.1.14.0 for the Content Hub SDK.

If you are unable to use this version, use this method to solve the error:

  1. In Microsoft Visual Studio, create a new library project called Sitecore.Connector.DI.

  2. Add the following package reference for the created project:

    RequestResponse
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.14" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.14" />
    <PackageReference Include="Sitecore.Kernel" Version="13.0.0-r*" />
  3. In the project, add a new class called Configurator.cs. Add the following code to it:

    RequestResponse
    using Microsoft.Extensions.DependencyInjection;
    using Sitecore.DependencyInjection;    
    namespace Sitecore.Connector.DI
    {
        public class Configurator:IServicesConfigurator
        {
            public void Configure(IServiceCollection serviceCollection){}
        }
    }  
  4. Compile the project into an assembly. On your Content Management (CM) instance, copy the assembly file to the bin folder

  5. On your CM instance, go to the \App_Config\Modules\Sitecore.Connector.CMP folder and add a new config file.

  6. Add the following configuration to the new config file:

    RequestResponse
    <?xml version="1.0"?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <sitecore>
            <services>    
                <configurator type="Sitecore.Connector.DI.Configurator, Sitecore.Connector.DI"/>
            </services>
        </sitecore>
    </configuration>
    
  7. Save the file.

Empty Sitecore Attribute or Content Hub Mapping Field on Item error

You might see an Empty Sitecore Attribute or Content Hub Mapping Field on Item error in the log after you click Select in a DAM public link selection window.

When you select the public link, DAM retrieves the attribute mapping configuration item. By default, Sitecore uses the English version field value in the attribute mapping configuration item. If you use a language other than English, for example Japanese, in the content editor, in the Master DB/System/Modules/DAM/Config/Mapping item, enter the language value for the Japanese language version.

SXA fields do not work with DAM functionality

Although DAM functionality is not available for SXA, when the DAM connector is installed, all image types in Sitecore have Browse Sitecore DAM enabled. You can use a workaround to enable SXA to utilize DAM functionality.

In the following procedure, we use the SXA favicon field as an example, but the same applies to other SXA fields that have DAM functionality. The main reason why the DAM image link does not work is because the MediaManager.GetMediaUrl() method is utilized when the favicon field value is being retrieved by SXA.

To resolve this problem:

  1. Patch the Sitecore.XA.Feature.SiteMetadata.Extensions.FieldExtensions.GetImageUrl() method or create a new extension class using the following method:

    RequestResponse
    public static class MediaExtension
         {
             public static string GetImageUrl(this Field field, Item item, ID fieldId, bool includeServerUrl = true)
             {
                 var imageUrl = string.Empty;
                 if (field != null)
                 {
                     var imageField = (ImageField)field;
                     if (imageField != null)
                    {
                         if (imageField.MediaItem == null)
                         {
                             XmlField imageDAMField = item?.Fields[fieldId];
                             string src = imageDAMField.GetAttribute("src");
                             return src;
                         }
                         else
                         {
                             var urlOptions = new MediaUrlBuilderOptions();
                             urlOptions.AlwaysIncludeServerUrl = includeServerUrl;
                             return MediaManager.GetMediaUrl(imageField.MediaItem, urlOptions);
                         }
                     }
                 }
                 return imageUrl;
             }
     } 
  2. Patch the Sitecore.XA.Feature.SiteMetadata.Repositories.Favicon.FaviconRepository.GetFaviconHref() method to use the following method extension:

    RequestResponse
    public virtual string GetFaviconHref(Item contextItem)
             {
                 var faviconHref = string.Empty;
                 var settingsItem = GetSettingsItem(contextItem);
                 var faviconField = settingsItem.Fields[Templates._Favicon.Fields.Favicon];
                 if (faviconField != null)
                 {
                     faviconHref = faviconField.GetImageUrl(settingsItem, faviconField.ID, false);
                 }
                 return faviconHref;
             
  3. In the Sitecore.XA.Feature.SiteMetadata.config file, add the FaviconRepository repository (or your custom repository) to the implementation. For example:

    RequestResponse
    <register serviceType="Sitecore.XA.Feature.SiteMetadata.Repositories.Favicon.IFaviconRepository, Sitecore.XA.Feature.SiteMetadata" implementationType="<customFaviconRepository>, <customAssembly>" lifetime="Singleton" />

Known issues with the DAM connector

The following table explains some of the issues you might encounter when you use the DAM functionality in SCCH, and how to resolve them.

Area where issue appears

Description

Workaround

Content type

When the content type of an asset is changed in Content Hub DAM, the change is not reflected in Sitecore. The rendition in Sitecore is therefore not shown.

n/a

Image Properties

In the Content Editor, right-clicking on an image shows two options: Image Map Editor and Properties. If either is selected and you click on the Image Manager icon, the Media Library that is opened is not the Sitecore DAM library but the sitecore/media library. There is no option to change the media library.

n/a

Change an image

Content Editor: With a Sitecore DAM image inserted by clicking Browse and selecting an image from the sitecore/media library, the image field is not cleared correctly.

Clear the field by using the clear link, save the item and then select a new image.

Clear the image field

Experience Editor: Clearing an image by clicking Remove the image without saving does not clear the field, even though the image is not displayed in the Experience Editor.

Click Save to resolve the issue.

Change from DAM to media library image

Experience Editor: When you insert an image from Sitecore DAM, then click Choose an image and insert a new image from the sitecore/media library to replace the Sitecore DAM image, the field is not cleared correctly.

Click Remove image , click Save, then insert an image from the sitecore/media library.

SXA

SXA is not supported for this version.

Refer to this workaround

SXA

If SXA is installed, and the IFrame is opening, the error MAsset Command is not implemented is returned and the IFrame fails to open.

This issue is resolved by updating the SXA config file Sitecore.XA.Feature. ContentTokens.config in the App_Config\Modules\SXA\Feature\ folder. In front of the Command Script tag, prepend the following SXA key attribute:

<script key = “SXA” src=”/sitecore/shel l/Controls/Rich Text Edit/ Insert Content Token Command.js” language=“Javascript”/>

Behaviour Rich Text Editor

When inserting a video in the Rich Text Editor using the Design mode, the video cannot be moved or deleted. It can only be played.

However, two console errors are thrown.

Switch to the HTML mode and adjust the video element as necessary.

Behaviour Rich Text Editor

When an item containing only a video is saved and reopened using the Design mode, the item is frozen and cannot be edited.

Switch to the HTML mode and add an element as necessary. This will unfreeze the item.

Login Procedure

As part of the login procedure, the window will refresh, and the content/experience editor will close without any warning message.

Save all changes prior to continuing to the login. Once you are logged in the window will not refresh again.

Sitecore DAM login with Chrome in Incognito mode

In Sitecore Content Editor, if you use Chrome in Incognito mode, when you click Browse Sitecore DAM and attempt to sign in, the Sign In dialog box opens again asking for your credentials.

In the Chrome browser, set cookies option to Allow all cookies. Refer to the browser documentation for details.

Do you have some feedback for us?

If you have suggestions for improving this article,