I'm getting the following error when I try to personalize a JSS component that was deployed into a JSS tenant on 9.2:

> Cannot read property 'image' of undefined
TypeError: Cannot read property 'image' of undefined
   at DemoSimplePromo (C:\inetpub\wwwroot\sc92sc.dev.local\dist\react-with-sitecore\server.bundle.js:26682:25)
   at c (C:\inetpub\wwwroot\sc92sc.dev.local\dist\react-with-sitecore\server.bundle.js:12516:496)
   at Ga (C:\inetpub\wwwroot\sc92sc.dev.local\dist\react-with-sitecore\server.bundle.js:12519:1)
   at a.render (C:\inetpub\wwwroot\sc92sc.dev.local\dist\react-with-sitecore\server.bundle.js:12524:367)
   at a.read (C:\inetpub\wwwroot\sc92sc.dev.local\dist\react-with-sitecore\server.bundle.js:12523:450)
   at renderToString (C:\inetpub\wwwroot\sc92sc.dev.local\dist\react-with-sitecore\server.bundle.js:12535:82)
   at process (C:\inetpub\wwwroot\sc92sc.dev.local\dist\react-with-sitecore\server.bundle.js:16563:20)
   at processTicksAndRejections (internal/process/task_queues.js:85:5)

Note that image is a field on the template that was created from the component definition, as part of the deployment.

export default function(manifest) {
name: 'Demo-SimplePromo',
icon: SitecoreIcon.Target,
fields: [
  { name: 'heading', type: CommonFieldTypes.SingleLineText },
  { name: 'content', type: CommonFieldTypes.RichText },
  { name: 'image', type: CommonFieldTypes.Image},
  { name: 'link', type: CommonFieldTypes.GeneralLink}

All I did was add a where true condition to the rendering in Experience Editor. I tried pointing it to a new data source (created by duplicating the data source item created by the deploy script), but I also tried just setting the personalized data source to the same item as the default.

  • can you please try with renaming the "image" field to like "xyzimageabc". – Hussain Jul 30 at 4:15
  • 1
    Please try to implement the personalization in the sample app and verify that its issue with Sitecore environment or Custom Component developed by you. – Amit Kumar Jul 30 at 8:03
  • Thanks for the suggestion Amit Kumar. However, the same error happens when I personalize one of the "Content Data" examples int he Styleguide. (Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: Cannot read property 'sample' of undefined) – Andy Uzick Jul 30 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.