Open BarryFogarty opened 4 months ago
Hi,
Have you used uSync.Migrations to Generate the migrated files ? or have you done that another way.
Hi Kevin - yes I generated a sync pack on the v8 site with a Packer. Then used uSync.Migrations on the v13 target site to generate the files. The migration part works fine, the failure happens on an in-place import. It is something to do with the unpublished state. The error does not occur when I edit a generated file to <Published Default="true" />
hi if you can send us the file i'll see if i can spot anything (kevin@jumoo.co.uk).
I can confirm above behavior. Generated config files (uSync.Migrations) contain properly migrated values (blocklists instead of nested content in my case). However it fails during the import (same exception as above). Downgrade to v12 fixes the problem.
Getting this too.. The migrated config is below..
If it helps.. it does seem to relate to unpublished content.
Some more info.. If I try to set the link and save the content node in the backoffice I get failed to save prob due to bad import data.. However, if I then publish and unpublish with a new link.. then rerunning the import it all works?
In between I did add to the MultipleUrlPickerMigrator
which was the bad data in my instance..
using uSync.Migrations.Migrators.Core;
using UmbConstants = Umbraco.Cms.Core.Constants;
namespace uSyncMigrationSite.Extensions.Migrators
{
[SyncMigrator(UmbConstants.PropertyEditors.Aliases.MultiUrlPicker)]
[SyncMigratorVersion(8)]
public class SMMultiUrlPickerMigrator : MultiUrlPickerMigrator
{
public override string? GetContentValue(SyncMigrationContentProperty contentProperty, SyncMigrationContext context)
{
if (string.IsNullOrWhiteSpace(contentProperty.Value))
{
return contentProperty.Value;
}
try
{
var config = JsonConvert.DeserializeObject<List<MultiUrlPickerValueEditor.LinkDto>>(contentProperty.Value);
return JsonConvert.SerializeObject(config);
}
catch
{
var x = base.GetContentValue(contentProperty, context);
return x;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Content Key="807c1ba9-4b87-43cd-8982-e2a0f192a68a" Alias="Merry Christmas" Level="4">
<Info>
<Parent Key="28eea678-91b8-4f00-9482-ecd52e8b0339">Homepage Auctions</Parent>
<Path>/Assets/Carousels/HomepageAuctions/MerryChristmas</Path>
<Trashed>false</Trashed>
<ContentType>carouselSlide</ContentType>
<CreateDate>2021-12-14T18:42:16</CreateDate>
<NodeName Default="Merry Christmas" />
<SortOrder>21</SortOrder>
<Published Default="false" />
<Schedule />
<Template />
</Info>
<Properties>
<backgoundImage>
<Value><![CDATA[[
{
"key": "cf33277c-b7fe-412e-b0db-d125066e5f06",
"mediaKey": "15d2a64b-31f4-443c-a2cd-bc8a4c4fe1b4"
}
]]]></Value>
</backgoundImage>
<cta>
<Value><![CDATA[{
"layout": {
"Umbraco.BlockList": [
{
"contentUdi": "umb://element/46ba635a626c48dd8c9d03cad844d672"
}
]
},
"contentData": [
{
"contentTypeKey": "a8dc72bc-1c2c-4e80-ab60-b99c91b1cf17",
"udi": "umb://element/46ba635a626c48dd8c9d03cad844d672",
"link": "[{\"name\":\".\",\"target\":null,\"udi\":\"umb://document/4b5454af0fe24529997231be8df1cae9\",\"url\":null,\"queryString\":null}]",
"buttonColour": "{\r\n \"value\": \"ffffff\",\r\n \"label\": \"White\",\r\n \"sortOrder\": 1,\r\n \"id\": \"2\"\r\n}",
"backgroundColour": ""
}
],
"settingsData": []
}]]></Value>
</cta>
<description>
<Value><![CDATA[<p> </p>
<p><span class="ui-provider">Thank you for your support in 2023 and we hope you have a successful 2024. We wish you an enjoyable and safe Christmas, with family and loved ones.</span></p>
<p>Our offices and auction centres will be closed from 1pm on Friday 22nd December and will re-open on Tuesday 2nd January.</p>
<p>Have a great Christmas and a happy New Year!</p>]]></Value>
</description>
<saleId>
<Value><![CDATA[]]></Value>
</saleId>
<subtitle>
<Value><![CDATA[& Happy New Year]]></Value>
</subtitle>
</Properties>
</Content>
I am migrating legacy v8 Nested Content to BlockList v13. Datatypes import fine, however the following error is generated when importing content:
Error: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Umbraco.Cms.Core.Models.Blocks.BlockValue' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path '', line 1, position 1.
Interestingly this only seems to affect unpublished content items. It seems to be a reasonably recent regression as importing the same files to a v12.3.9 (with uSync 12.2.3) is not affected.
NB I am importing on top of an existing database, in order to maintain user permission config. I will try on a fresh DB but I believe it is not affected by this issue. Perhaps uSync is first attempting to deserialize the Nested Content data held in the blocklist property in this context, rather than simply overwriting it.