9

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

7 Answers 7

12

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 Jan 12, 2022 at 15:00
5

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
  }
}
3

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

3
  • 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, 2022 at 3:35
  • This is the best query to not catch false positives.
    – Chris Auer
    Sep 28, 2022 at 15:39
  • Just a note: In the first query, it's the second column--ItemId--that identifies the items with missing blobs. Nov 20, 2023 at 17:32
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
1

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>
1
  • Implementation prevents uploading new media item since Sitecore creates an empty media item and then attaches a blob. Since the item does not have blob Id, null provider is going to be used and will not allow to set blob stream. To fix this, you need to implement methods CreateBlobIdentifier correctly. Jan 22 at 15:55
0

I followed the same methodology as this blog post, importing content via multiple smaller packages in order to narrow down to which item was causing the issue. NOTE: I noticed I would only see the error when publishing from the Media Library root folder, or from a high level parent folder. If I were to publish a sub-folder the error would not occur.

At the end of the process I found there was a PDF item which had an empty file extension field. Deleting this item and republishing resolved my issue.

0

Building on @Nikola Kramaric's answer, I added a little logging (in case, like me, you have a lot of items and weren't sure if it was working) and also put in a line for the deletion (commented out for safety).

Write-Host "Getting items..." -NoNewLine;
$items = Get-ChildItem -Recurse -Path "master:/sitecore/media library" | Where-Object { $_.TemplateID -ne [Sitecore.TemplateIDs]::MediaFolder -and $_.TemplateID -ne [Sitecore.TemplateIDs]::Node }
Write-Host "done." -Fore Green;

$i = 0;
$items | ForEach-Object {
  $mediaItem = [Sitecore.Data.Items.MediaItem]$_
  $blobField = $mediaItem.InnerItem.Fields["blob"]
  if($blobField -and [string]::IsNullOrEmpty($blobField.Value))
  {
      Write-Host "Empty Blob Item:" $_.ID $_.Name  $_.Paths.FullPath;
      #$_ | Remove-Item;
  }
  $i++;
  if (($i % 500) -eq 0) {
      Write-Host "Reviewed $i items";
  }
}
Write-Host "Finished. Reviewed $i total items." -Fore Green

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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