6

I hit this on a Sitecore 10.1 upgrade when trying to publish

Sitecore.Framework.Data.Blobs.Abstractions.BlobProviderException: No supported provider for  is configured.
   at Sitecore.Framework.Data.Blobs.BlobStorage.GetBlobProvider[T](BlobIdentifier identifier)
   at Sitecore.Publishing.PublishHelper.CopyBlobField(Field sourceField, Item targetVersion)
   at Sitecore.Publishing.PublishHelper.CopyBlobFields(Item sourceVersion, Item targetVersion)
   at Sitecore.Publishing.PublishHelper.TransformToTargetVersion(Item sourceVersion)
   at Sitecore.Publishing.PublishHelper.CopyToTarget(Item sourceVersion, Item originalItem)
   at Sitecore.Publishing.PublishHelper.PublishVersionToTarget(Item sourceVersion, Item targetItem, Boolean targetCreated)
   at Sitecore.Publishing.PublishHelper.PublishVersion(Item sourceVersion)
   at Sitecore.Publishing.Pipelines.PublishItem.PerformAction.Process(PublishItemContext context)

I have run the UpgradeApp.exe tool as per the upgrade guide. What else am I missing?

0

5 Answers 5

11

That issue will occur if there is a reference from a media item "blob" field to a missing blob in the "Blobs" table.

It might be that the UpgradeApp.exe tool wasn't able to clean up some system media files correctly.

You can run this SQL to find such fields:

select itemid
FROM [dbo].[SharedFields] s
left join [dbo].[Blobs] b on s.value = '{' + cast(b.BlobId as varchar(36)) + '}'
where s.fieldid = '{40E50ED9-BA07-4702-992E-A912738D32DC}' and blobid is null

And then you can verify them and then safely delete out those SharedFields from the database.

You can also check the versioned blob fields in case you are using versioned media items

select itemid 
FROM [dbo].[Fields] s 
left join [dbo].[Blobs] b on s.value = '{' + cast(b.BlobId as varchar(36)) + '}' 
where s.fieldid = '{DBBE7D99-1388-4357-BB34-AD71EDF18ED3}' and blobid is null
2
  • 2
    Thanks for this. To make it complete, this can as well happen in a versioned blob field. So check with the following SQL command as well: select itemid FROM [dbo].[Fields] s left join [dbo].[Blobs] b on s.value = '{' + cast(b.BlobId as varchar(36)) + '}' where s.fieldid = '{DBBE7D99-1388-4357-BB34-AD71EDF18ED3}' and blobid is null
    – wene37
    May 5, 2021 at 9:16
  • On our installation the s.value could contain IDs both with and without curly braces. So for our installation we had to do the following tweak to the SQL to get the list of media items without blobs: select itemid FROM [dbo].[SharedFields] s left join [dbo].[Blobs] b on s.value = cast(b.BlobId as varchar(36)) OR s.value = '{' + cast(b.BlobId as varchar(36)) + '}' where s.fieldid = '40E50ED9-BA07-4702-992E-A912738D32DC' and blobid is null
    – GTHvidsten
    Jan 12 at 15:00
3

The issue seems to be caused by media items that do not have any media associated with them. I ran the following script to find those particular items and then manually deleted them. I could have deleted them via the script but chose to be careful with this since its a production environment.

$items = Get-ChildItem -Recurse -Path "master:/sitecore/media library" | Where-Object { $_.TemplateID -ne
[Sitecore.TemplateIDs]::MediaFolder -and $_.TemplateID -ne [Sitecore.TemplateIDs]::Node }

$items | ForEach-Object {
  $mediaItem = [Sitecore.Data.Items.MediaItem]$_
  $blobField = $mediaItem.InnerItem.Fields["blob"]
  if($blobField -and [string]::IsNullOrEmpty($blobField))
  {
      Write-Host "Empty Blob Item : " $_.ID $_.Name  $_.Paths.FullPath
  }
}
1

If you don't have direct access to the database, you can also execute the SQL command using Sitecore Powershell Extensions:

$sql = @"
select itemid
FROM [dbo].[SharedFields] s
left join [dbo].[Blobs] b on s.value = '{' + cast(b.BlobId as varchar(36)) + '}'
where s.fieldid = '{40E50ED9-BA07-4702-992E-A912738D32DC}' and blobid is null
"@

Import-Function Invoke-SqlCommand

$connection = [Sitecore.Configuration.Settings]::GetConnectionString("master")
$builder = New-Object System.Data.SqlClient.SqlConnectionStringBuilder $connection
$dbName = $builder.InitialCatalog
$query = $sql
    
Invoke-SqlCommand -Connection $connection -Query $query -As Scalar
0

If you want the publish to still work with empty blob fields, and workaround what I consider to be a regression, just create a new blob provider class that will handle the cases when the blob fields are empty.

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using Sitecore.Framework.Data.Blobs.Abstractions;

namespace Dlw.ScBase.Website.Modules.Foundation.AppBase.Providers
{
    /// <summary>
    /// Fix an issue in Sitecore from 10.1 that does not allow to publish an item/media
    /// containing an empty Blob field
    /// </summary>
    public class NullBlobProvider : IBlobProvider
    {
        public bool BlobExists(BlobIdentifier identifier) => false;

        public bool CanHandle(BlobIdentifier identifier) => string.IsNullOrEmpty(identifier.ToString());

        public BlobIdentifier CreateBlobIdentifier() => new BlobIdentifier(string.Empty);
        public BlobIdentifier CreateBlobIdentifier(Guid guid) => new BlobIdentifier(string.Empty);

        public Stream GetBlob(BlobIdentifier identifier) => null;

        public void RemoveBlob(BlobIdentifier identifier) {}

        public void SetBlob(Stream stream, BlobIdentifier identifier) {}

        public Guid ToGuid(BlobIdentifier identifier) => Guid.Empty;
    }
}

Create then a Sitecore config patch to add your new blob provider to the list of blob provider for the web database (or any target publishing database)

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore>
   <databases>
      <database id="web" role:require="Standalone or ContentManagement">
        <!-- Fix an issue in Sitecore from 10.1 that does not allow to publish an item/media containing an empty Blob field -->
        <BlobStorage>
          <providers>
            <provider name="null" type="Dlw.ScBase.Website.Modules.Foundation.AppBase.Providers.NullBlobProvider, Dlw.Scbase.Website"
                      patch:after="provider[@name='classic']"/>
          </providers>
        </BlobStorage>
      </database>
    </databases>
  </sitecore>
</configuration>
0

Thanks to Mark Gibbons we ended up running the below queries which resolved the publishing issue for our solution

SELECT * FROM dbo.SharedFields WHERE fieldid = '{40E50ED9-BA07-4702-992E-A912738D32DC}' AND Value = ''

To find items with no Blob associated

DELETE FROM dbo.SharedFields WHERE fieldid = '{40E50ED9-BA07-4702-992E-A912738D32DC}' AND Value = ''

To Clear these references and allow Publishing to resume without issue

1
  • On an added note, we found some of the above queries to include media items that had a blob associated, so this was the simplest and most precise query to run against the master database that resolved our publishing issues. It appears this is a recurring issue associated with content editing.
    – xstreamist
    Feb 4 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.