1

I am using Sitecore 10.2. I am able to run my sample nextjs application in connected mode using the command in VS Code terminal jss start:connected.

But I am not able to open my application in local integrated mode and it is throwing the below error.

Error in experience editor mode/ preview mode

Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Sitecore.JavaScriptServices.ViewEngine.Http.XmlConfigurationReader.ProcessPropertyNode(XmlNode propertyNode, HttpRenderEngineOptions options)
   at Sitecore.JavaScriptServices.ViewEngine.Http.XmlConfigurationReader.CreateOptionsFromConfig(XmlNode config)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Sitecore.JavaScriptServices.ViewEngine.Http.XmlConfigurationReader.GetAll()
   at Sitecore.JavaScriptServices.ViewEngine.Http.XmlConfigurationReader.GetById(String id)
   at Sitecore.JavaScriptServices.ViewEngine.Http.RenderEngineOptionsResolver.ResolveForId(String id, RenderEngineOptions runtimeOptions)
   at Sitecore.JavaScriptServices.ViewEngine.Http.HttpRenderEngineFactory.CreateEngine(RenderEngineOptions options)
   at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.ResolveRenderEngine()
   at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.Render(TextWriter writer)
   at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)

I have verified scconfig and other configs like .env and config under sitecore/config in next js app. Everything is fine. Do anyone faced such issue and how resolved such issue?

1 Answer 1

0

You are encountering an error that suggests you already have an API key with the same item ID, resulting in the error message you're seeing. If you are working with a sample site, you can resolve this issue by clearing the items from the database using the .\clean.ps1 script and then running the project again. This script will help remove any existing items and allow you to start fresh without any conflicts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.