KevinJump/uSync

RC4 - Issues importing variant content

Closed this issue ยท 4 comments

Describe the bug
I've taken a clean export of a v13.3.2 site, using uSync v13.2.2, and attempted to import into a v14 RC4 site using uSync v14.0.0-rc4.

It appears that variant content is failing to import, I don't get any error messages on the uSync dashboard itself, but I do get these two error messages in the log:
"Content Page 6" Culture "en-gb" is not one of the available cultures, so we cannot set this value

"ContentTemplateHandler": Import Failed : "System.InvalidOperationException: Cannot save content with an empty name. at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.DocumentRepository.EnsureInvariantNameExists(IContent content) at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.DocumentRepository.SanitizeNames(IContent content, Boolean publishing) at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.DocumentRepository.PersistNewItem(IContent entity) at Umbraco.Cms.Core.Cache.DefaultRepositoryCachePolicy`2.Create(TEntity entity, Action`1 persistNew) at Umbraco.Cms.Core.Services.ContentService.SaveBlueprint(IContent content, Int32 userId) at uSync.Core.Serialization.Serializers.ContentTemplateSerializer.SaveItem(IContent item) at uSync.Core.Serialization.SyncSerializerRoot`1.Deserialize(XElement node, SyncSerializerOptions options) at uSync.BackOffice.SyncHandlers.SyncHandlerRoot`2.ImportElement(XElement node, String filename, HandlerSettings settings, uSyncImportOptions options)"

Unfortunately, there's no other helpful messages in the log, even with debug logging:

More log viewer screenshots

image
image

uSync seems to have correctly imported everything else, including the languages:
image

It appears that only the content nodes, that vary by culture, fail to import;

To Reproduce
Steps to reproduce the behavior:

  1. Perform a uSync export on an Umbraco 13 site that has variant content.
  2. Copy the uSync folder contents to a new Umbraco 14 RC4 site
  3. Run a full uSync import

Expected behavior
Content should import.

About your Site (please complete the following information):

  • Umbraco Version: v14.0.0-rc4
  • uSync Version: v14.0.0-rc4
  • Browser: Edge

ah ha - thanks you have found an undocumented breaking change ๐ŸŒŸ

fixed now, not sure given the compressed timescales we will release an update before final. but you can get a build with this fix in it from our internal nuget feed.

https://dev.azure.com/jumoo/Public/_artifacts/feed/nightly/NuGet/uSync/overview/14.0.0-rc4.20240524.1

Cheers Kevin! Love an undocumented breaking change ๐Ÿ˜œ

I've just tested the nightly build and I can confirm that the Culture "en-gb" is not one of the available cultures error messages are gone, but I'm still getting the Cannot save content with an empty name warnings, and the variant content is not being imported.

Here's a .zip of my v13 variant test export:
v9.zip
Which I imported into a blank Umbraco v14-RC4 site.

image

@MessageTemplate: {alias}: Import Failed : {exception}
alias: ContentHandler
exception:

System.InvalidOperationException: Cannot save content with an empty name. at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.DocumentRepository.EnsureInvariantNameExists(IContent content) at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.DocumentRepository.SanitizeNames(IContent content, Boolean publishing) at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.DocumentRepository.PersistNewItem(IContent entity) at Umbraco.Cms.Core.Cache.DefaultRepositoryCachePolicy`2.Create(TEntity entity, Action`1 persistNew) at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.EntityRepositoryBase`2.Save(TEntity entity) at Umbraco.Cms.Core.Services.ContentService.Save(IContent content, Nullable`1 userId, ContentScheduleCollection contentSchedule) at Umbraco.Cms.Core.Services.ContentService.CreateAndSave(String name, Int32 parentId, String contentTypeAlias, Int32 userId) at uSync.Core.Serialization.Serializers.ContentSerializer.CreateItem(String alias, ITreeEntity parent, String itemType) at uSync.Core.Serialization.Serializers.ContentSerializerBase`1.FindOrCreate(XElement node) at uSync.Core.Serialization.Serializers.ContentSerializer.DeserializeCore(XElement node, SyncSerializerOptions options) at uSync.Core.Serialization.SyncSerializerRoot`1.Deserialize(XElement node, SyncSerializerOptions options) at uSync.BackOffice.SyncHandlers.SyncHandlerRoot`2.DeserializeItem(XElement node, SyncSerializerOptions options) at uSync.BackOffice.SyncHandlers.SyncHandlerRoot`2.ImportElement(XElement node, String filename, HandlerSettings settings, uSyncImportOptions options)

SourceContext: uSync.BackOffice.SyncHandlers.Handlers.ContentHandler
ActionId: 3558f541-e746-46a7-8d77-7003872a5596
ActionName: uSync.Backoffice.Management.Api.Controllers.Actions.uSyncPerformActionController.PerformAction (uSync.Backoffice.Management.Api)
RequestId: 4000005c-0001-de00-b63f-84710c7967bb
RequestPath: /umbraco/usync/api/v1/Perform

Ahh. congratulations you have found a bug in Umbraco v14-rc4 ๐Ÿ˜‰ - but i think we can work around it. ๐Ÿ˜„

turns out i fixed it for existing content, but there is an issue with contentService.CreateAndSave when you have invariants.
but i think we don't need to use this (i can't remember quite why we switched to it?).

but if we go back to simply creating the content and saving it a bit later in the process then it works.

dotnet add package uSync --version 14.0.0-rc4.20240524.12

https://dev.azure.com/jumoo/Public/_artifacts/feed/nightly/Npm/@jumoo%2Fusync-assets/overview/14.0.0-rc4.20240524.12

(only took me 11 goes to figure that out!)

Ahh. congratulations you have found a bug in Umbraco v14-rc4 ๐Ÿ˜‰ - but i think we can work around it. ๐Ÿ˜„

Great... ๐Ÿ˜† fingers crossed that gets fixed before Umbraco 14 is released!

Thanks for pushing a fix so quickly! I've tested the new nightly build and confirm it now works a treat!