limbo-works / Limbo.Umbraco.Tables

Table editor for Umbraco.
https://packages.limbo.works/limbo.umbraco.tables/
MIT License
6 stars 8 forks source link

JSON token issue causing Tables to break internal indexing in Umb 13.4.1 #39

Open Eaglef90 opened 1 week ago

Eaglef90 commented 1 week ago

I am currently on Umbraco 13.4.1 but this has been an issue for most of the year so I don't kniow which Umbraco 13 version it started in as I just now found the root cause. This seems to only affect the internal index. When building the index a token serialzation error is thrown and indexing stops. The error in the logs is:

Index populating failed for populator "Umbraco.Cms.Infrastructure.Examine.ContentIndexPopulator"

System.InvalidCastException: Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken. at Newtonsoft.Json.Linq.Extensions.Convert[T,U](T token) at Newtonsoft.Json.Linq.JToken.Value[T](Object key) at Limbo.Umbraco.Tables.PropertyEditors.TablePropertyIndexValueFactory.ProcessRow(JArray row)+MoveNext() at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at Umbraco.Cms.Core.PropertyEditors.NestedPropertyIndexValueFactoryBase2.GetResumeFromAllContent(List1 indexedContent) at Umbraco.Cms.Core.PropertyEditors.NestedPropertyIndexValueFactoryBase2.HandleResume(List1 indexedContent, IProperty property, String culture, String segment, Boolean published)+MoveNext() at Umbraco.Cms.Infrastructure.Examine.BaseValueSetBuilder1.AddPropertyValue(IProperty property, String culture, String segment, IDictionary2 values, IEnumerable1 availableCultures, IDictionary2 contentTypeDictionary) at Umbraco.Cms.Infrastructure.Examine.ContentValueSetBuilder.GetValueSetsEnumerable(IContent[] content, Dictionary2 creatorIds, Dictionary2 writerIds)+MoveNext() at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable1 items) at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Umbraco.Cms.Infrastructure.Examine.ContentIndexPopulator.IndexAllContent(Int32 contentParentId, Int32 pageIndex, Int32 pageSize, IReadOnlyList1 indexes) at Umbraco.Cms.Infrastructure.Examine.ContentIndexPopulator.PopulateIndexes(IReadOnlyList`1 indexes) at Umbraco.Cms.Infrastructure.Examine.IndexPopulator.Populate(IIndex[] indexes) at Umbraco.Cms.Infrastructure.Examine.ExamineIndexRebuilder.RebuildIndexes(Boolean onlyEmptyIndexes, TimeSpan delay, CancellationToken cancellationToken)

The only way to get this error to show in my logs was to shut down the website, delete the indexes and log file, then start the site up again. After waiting a few minutes for the indexing to run I will see this error in the log. The funny thing is that if I manually hit the "rebuild index" button the error is not thrown in the log but the index will fail to build and populate at all. This does not seem to affect the external index though.

AaronSadlerUK commented 1 week ago

@abjerner I have submitted a PR #40 which fixes this issue.