Sitecore 9.3 JSS
What is happening: Many a time, we are getting 500 from the layout service. In the log we have the following entry:
ERROR Exception during Layout Service RenderItem (configuration: jss, item: /)
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.LayoutService
at Sitecore.LayoutService.Extensions.RenderingExtensions.IsSerializable(Rendering rendering, IEnumerable`1 serializableRenderingTypes)
at Sitecore.LayoutService.Pipelines.GetRenderer.GetJsonRenderer.Process(GetRendererArgs args)
at Sitecore.JavaScriptServices.ViewEngine.Pipelines.Response.GetRenderer.GetJsonRenderer.Process(GetRendererArgs 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.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs,TResult](String pipelineName, TArgs args, Func`2 resultGetter)
at Sitecore.Mvc.Presentation.Rendering.GetRenderer()
at Sitecore.Mvc.Presentation.Rendering.get_Renderer()
at Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.CreateCyclePreventer(String placeholderName, Rendering rendering)
at Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs 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.LayoutService.ItemRendering.PlaceholderRenderingService.RenderPlaceholder(PlaceholderDefinition placeholderDefinition, IRenderingConfiguration renderingConfiguration)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Sitecore.LayoutService.ItemRendering.LayoutService.Render(Item item, IRenderingConfiguration renderingConfiguration, RenderOptions renderOptions)
at Sitecore.LayoutService.Mvc.Controllers.LayoutServiceController.RenderItem(String configuration, String item)
When we make any change in the placeholder in the shared layout and publish it, the issue gets resolved. Though this re-occurs after some time.
I have tried by disabling all the components from the final-layout to rule-out any issue with the components.