Closed petedavisdev closed 2 years ago
Hi @petedavisdev - Thanks for the information, I've added this to our backlog to investigate / fix in a future release.
Just out of curiosity, did you figure out why the GraphQL query was returning null values and/or the solution? e.g. bad index, solved by a re-index
Hi @ambrauer,
I found a fix for the issue are some digging into the source code. The cause of the issue is that the item had been deleted but the item was still in the index. Even after rebuilding the index it remained
A small change to the following file will solve it Sitecore.Services.GraphQL.EdgeSchema.Services.SearchService, Sitecore.Services.GraphQL.EdgeSchema
After this line
IEnumerable<Item> source2 = results.Hits.Select<SearchHit<ContentSearchResult>, Item>((Func<SearchHit<ContentSearchResult>, Item>)(searchHit => searchHit.Document.GetItem()));
Filter out null items e.g.
source2 = source2.Where(i => i != null);
I patched in the change and nulls won't be returned in the json
Fixed by #1150
Description
When running
npm run build
we get the following error:I added
console.log(results);
on line 135 of the above file and got:As you can see, we are getting some null values returned. These need to be filtered out to enable the build to complete.
Expected behavior
There should not be null values returned to graphql-sitemap-service.js or the build should complete, ignoring the null values.
Steps To Reproduce
Possible Fix
Your Environment