On my headless SXA 10.2 CM instance, I have a page in my tree (within a bucket) where if I try to browse for a rendering datasource, the popup does not appear, and an error appears in my logs. This happens for all renderings on the page, both in the shared layout and final layout.
When I click the "Browse" button, I see a POST
request to /sitecore/shell/applications/field editor.aspx?mo=mini&hdl=xxxxx
. This request gets a 302 response and an exception appears in the logs:
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
at Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline)
at Sitecore.Pipelines.Pipeline.Start(PipelineArgs args, Boolean atomic)
at Sitecore.Web.UI.Sheer.ClientPage.RunPipelines()
at Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e)
at Sitecore.Shell.Applications.ContentManager.FieldEditorPage.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Nested Exception
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.XA.Foundation.LocalDatasources
at Sitecore.XA.Foundation.LocalDatasources.Services.DataSourceLocationsService.GetRoots(Item contextItem, String query)
at Sitecore.XA.Foundation.LocalDatasources.Services.DataSourceLocationsService.GetDataSourceRoots(Item contextItem, Item renderingItem)
at Sitecore.XA.Foundation.LocalDatasources.Pipelines.GetRenderingDatasource.GetDatasourceLocation.Process(GetRenderingDatasourceArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.XA.Foundation.LocalDatasources.CustomFields.FieldTypesEx.BucketInternalLink.ShowDialog(ClientPipelineArgs args)
I can only seem to reproduce the issue on one specific page item. If I duplicate that page item, I am able to browse for rendering data sources without issue. When I click the button, the POST
to /sitecore/shell/applications/field editor.aspx?mo=mini&hdl=xxxxx
gets a 200 response.
At first I thought this was an issue with a bad value in the renderings or final renderings, but both the problem item and the duplicated (working) item have the same exact values.
The source code for GetRoots()
looks potentially problematic, but it's not clear what the exact issue is:
protected virtual Item[] GetRoots(Item contextItem, string query)
{
Item[] roots = (Item[]) null;
if (query.StartsWith("./", StringComparison.InvariantCulture) && !string.IsNullOrEmpty(contextItem.Paths.FullPath))
{
if (contextItem != null)
roots = contextItem.Axes.SelectItems(this.GetWorkingQuery(query));
}
else
roots = this.DatabaseRepository.GetContentDatabase().SelectItems(this.GetWorkingQuery(query));
return roots;
}