Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Eaglef90 opened this issue Sep 9, 2024 · 2 comments · Fixed by #40
Closed

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

Eaglef90 opened this issue Sep 9, 2024 · 2 comments · Fixed by #40
Labels
release/13.0.2 Issues and tasks related to version 13.0.1. type/bug Task is a bug. Fix it please! umbraco/v13 Issues and tasks related to Umbraco 13.

Comments

@Eaglef90
Copy link

Eaglef90 commented Sep 9, 2024

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 added a commit to AaronSadlerUK/Limbo.Umbraco.Tables that referenced this issue Sep 11, 2024
@AaronSadlerUK
Copy link
Contributor

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

@abjerner
Copy link
Member

I've tried reproducing this in different versions of U13, but haven't been able to make it fail.

@Eaglef90 @AaronSadlerUK can either of you share some more information on how to reproduce this error?

I've tried testing with both a regular property editor and inside the block list, but in either case, the value comes back as a JValue of type String. Also when deleting the indexes, and rebooting the site.

abjerner pushed a commit that referenced this issue Oct 23, 2024
* Fixes the unable to cast to JToken exception

Fixes #39

* Updated minimum version

* Revert "Updated minimum version"

This reverts commit 2d39a82.

* Changed from feedback

Implemented the changes from @abjerner
@abjerner abjerner added type/bug Task is a bug. Fix it please! umbraco/v13 Issues and tasks related to Umbraco 13. release/13.0.2 Issues and tasks related to version 13.0.1. labels Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/13.0.2 Issues and tasks related to version 13.0.1. type/bug Task is a bug. Fix it please! umbraco/v13 Issues and tasks related to Umbraco 13.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants