java.lang.StackOverflowError/ScriptEvaluationException error in AEM 6.4 while rendering a React JS based Component | Community
Skip to main content
yashsavant
March 13, 2020
Solved

java.lang.StackOverflowError/ScriptEvaluationException error in AEM 6.4 while rendering a React JS based Component

  • March 13, 2020
  • 2 replies
  • 9354 views

 

Scenario : I am passing a huge chunk of data using "data-props" property to a react component.
the json data passed to the component  consists of 1000+ lines of code.
Eg : <div data-component="myComponent" class='react-mini-app' data-application-name='AppName' data-props={
"key1": "${properties.value3 @2941342="attribute"}",
"key2": "${properties.value2 @2941342="attribute"}",
.
.
.
"key999": "${properties.value999 @2941342="attribute"}",
"key1000": "${properties.value1000 @2941342="attribute"}"
}
</div>
there are 1000+ such key and value pair passed to the component in .html

When I try to load the page where the component is authored, it gives me the following error :

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Peter_Puzanovs

Hi Yash,

 

Ideally, you should be assembling one JSON and then outputting it with just one getter.

 

Have a look at this presentation, as it might come handy:

https://adapt.to/2019/en/schedule/a-non-spa-approach-for-aem-with-react.html

 

P.S. I am always happy to help you with consultation. Give me a shout at peter.puzanovs@hotmail.com

 

Regards,

Peter

2 replies

Peter_Puzanovs
Community Advisor
Community Advisor
March 14, 2020

Hi Yash,

 

Please check how you are passing these to the page. Most likely the issue is somewhere in your code. Rendering large json strings in Sightly does not cause stackoverflow's normally.

 

Regards,

Peter

yashsavant
March 14, 2020

Hi Peter, I dont think the problem is with the code here because if I refresh the page in my browser like 10-15 times, the error goes away and the component is loaded successfully. Also I tried to reduced the existing json data by half and it works fine with no errors. So I think it must be something else.
Thanks. 

Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
March 17, 2020

Hi Yash,

 

Ideally, you should be assembling one JSON and then outputting it with just one getter.

 

Have a look at this presentation, as it might come handy:

https://adapt.to/2019/en/schedule/a-non-spa-approach-for-aem-with-react.html

 

P.S. I am always happy to help you with consultation. Give me a shout at peter.puzanovs@hotmail.com

 

Regards,

Peter

yashsavant
March 23, 2020

Thanks for this solution Peter! I assembled all those 1000+ json data properties in Java using and used a getter to output it  in html and it worked with no errors. Thanks.