Can somebody help me on this

Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: Cannot read property 'context' of undefined TypeError: Cannot read property 'context' of undefined at C:\inetpub\wwwroot\sxa16.local\dist\my-first-jss-app\server.bundle.js:1:56408 at at process._tickCallback (internal/process/next_tick.js:160:7)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.Http.HttpNodeInstance.d__71.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.OutOfProcessNodeInstance.d__131.MoveNext() End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.JavaScriptServices.ViewEngine.NodeServices.DefaultNodeServices.d__101.MoveNext() End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Sitecore.JavaScriptServices.ViewEngine.NodeServices.DefaultNodeServices.d__101.MoveNext() --End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.JavaScriptServices.ViewEngine.Node.Helpers.AsyncHelpers.RunSync[TResult](Func`1 func) at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.Render(TextWriter writer) at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)

  • If you run the app in disconnected or connected mode do you see the same error? The error is being thrown inside your server.bundle.js, line 56408. Can you find that line in server.bundle.js (and maybe the surrounding lines also) and paste it here? – Adam Weber Mar 4 at 13:46
  • Yes the app is working fine in both disconnected and connected mode. Here is the content from the line 56408 managed to get :) key: "componentWillUnmount", value: function () { } key: "render", value: function () { var t = this.props.component, e = Object.assign({}, this.props); return delete e.component, e.sitecoreContext = this.context.contextFactory.getSitecoreContext(), a.default.createElement(t, e) } – Jagatheesh Menon Mar 5 at 9:24
  • Thanks. Can you zip up your JSS project (including the node_modules) folder and share it with us - jss@sitecore.net - via drive, dropbox, etc... – Adam Weber Mar 5 at 13:52
  • @AdamWeber Hi Adam I have shared the files it will be from jagatheeshmenon@gmail.com – Jagatheesh Menon Mar 6 at 14:35
  • I am also facing same issue. Please confirm if it is fixed. Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: Cannot read property 'ROUTE_CHANGE_COMPLETED' of undefined TypeError: Cannot read property 'ROUTE_CHANGE_COMPLETED' of undefined at t.a (C:\inetpub\wwwroot\sc91.sc\dist\jssadvancedappreactweb\server.bundle.js:1:849429) Layout Service response is fine: {"context":{"pageEditing":false,"site":{"name":"website"},"language":"en"},"name":"Home","displayName":"Home","fields":{"Text":{"value":"<p style=\"line-height: 22px;\">1- From a single connected platfo – Sumit Jha Apr 10 at 10:51

I'm unable to repro the issue with the provided files. I did the following to get the app up and running locally:

  • Ran jss setup to establish the values in scjssconfig.json. (it seems like you have already done this)
  • Ran jss deploy config to deploy the /sitecore/config/my-first-jss-app.config file to the Sitecore instance. (it seems like you have already done this, otherwise you'd likely be seeing a different error)
  • Ran jss deploy package --includeContent to generate the app manifest (with route data) and deploy it to Sitecore.

Note: the jss commands assume you have the JSS CLI installed globally. If not, prefix the commands with either npm run or yarn, depending on which package manager you use. e.g. npm run jss deploy package --includeContent.

The app was created in Sitecore successfully and I was able to browse to the home route in integrated mode without error.

Can you confirm that your import ran without error? You should see something like this in Sitecore under /sitecore/content:

1 `

  • H Adam Quite strange I have followed the exact same steps but when previewing the home node I am getting the below error. Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: Cannot read property 'context' of undefined TypeError: Cannot read property 'context' of undefined at C:\inetpub\wwwroot\sxa16.local\dist\my-first-jss-app\server.bundle.js:1:56408 at at process._tickCallback (internal/process/next_tick.js:160:7) at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.Http.HttpNodeInstance.d__7`1.MoveNext() – Jagatheesh Menon Mar 7 at 6:24
  • Can you try browsing to the Layout Service URL for the Home item? http://my-first-jss-app.dev.local/sitecore/api/layout/render/jss?item=/&sc_apikey=YOUR_API_KEY where YOUR_API_KEY is a valid SSC api key. Instructions for setting up a key if you don't already have one: jss.sitecore.net/#/setup/sitecore-config?id=step-2-api-key (note: substitute jssadvancedappreactweb with your host name). Once you're able to browse to the Layout Service URL, please paste the output here. – Adam Weber Mar 7 at 14:02
  • Hi Adam I have mailed you all the details from my mail Id : jagatheeshmenon@gmail.com – Jagatheesh Menon Mar 8 at 7:27
  • Hi Adam, The issue is with SXA which was installed with the instance and it looks like jss doesn't support SXA. Do we have any work around :) – Jagatheesh Menon Mar 8 at 10:14
  • Hi, I am also facing the same issue with SXA, Is there any inputs to resolve this issue? – Amit Kumar Jul 24 at 4:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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