Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

Uncaught RangeError: Maximum call stack size exceeded

Answered
Sergii Valko asked on July 5, 2019

Hello guys! I’ve found a bug, probably 🙂 It sounds ‘Uncaught RangeError: Maximum call stack size exceeded’. I spent a two hours to reproduce it, nevertheless I did it. So, please have a look into example(https://jsfiddle.net/2qes51ph/). It happens because no type for field ‘n’ is defined and some ‘measure’ uses filed ‘n’ in a formula. Thanks.

5 answers

Public
Vera Didenko Flexmonster July 5, 2019

Hello, Sergii,
 
Thank you for reaching out to us and providing a JSFiddle example for illustration.
 
First of all, we would like to point out that the same uniqueName should not be given to more than one field.
Please provide a different uniqueName for the calculated measure, for example:

{
"uniqueName": "n2",
"formula": "sum(\"n\") + 10",
"caption": "n2"

 
Also, it is important to remember that if only some fields are specified in the JSON data types object, the rest of the fields will be omitted because they were not mentioned in the first object of the JSON array.
Please note that in your case the omitted field n cannot be referred to in the calculated measure since it is not present in the Field List.
For more information about this, please see the “Undefined types in JSON” section of our JSON data types documentation.
 
Our team kindly suggests ensuring that all the necessary fields have been included in the first object of the JSON array.
 
Here is a modified version of the JSFiddle example where the above points are taken into account.
 
You are welcome to contact us in case any questions arise
 
Best Regards,
Vera

Public
Sergii Valko July 5, 2019

Thanks alot for the answer. I had a prediction in the same direction, nevertheless it would be much better if more certain error be shown, it will simplified debugging dramatically, because resolving such very general errors in the minified third parties js is like a looking for a needle in a haystack.

Public
Vera Didenko Flexmonster July 5, 2019

Hello, Sergii,
 
Thank you for your reply.
 
For such cases, we suggest creating the calculated values via the user interface.
After that, you can simply save the report with all the necessary formulas.
This approach allows minimizing of errors.
 
Here is a video tutorial on how to work with calculated values for guidance.
 
Please feel free to contact us in case of any questions.
 
Best Regards,
Vera

Public
jefryarch April 13, 2020

This error is almost always means you have a problem with recursion in JavaScript code, as there isn’t any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited. It’s possible to cause infinite recursion in a fully promisified code, too. That can happen if the promises in a chain don’t actually perform any asynchronous execution , in which case control never really returns to the event loop, even though the code otherwise appears to be asynchronous. That’s when it’s useful to wrap your recursive function call into a –

  • setTimeout
  • setImmediate or
  • process.nextTick

Also, you can localize the issue by setting a breakpoint on RangeError type of exception , and then adjust the code appropriately. Moreover, you can managed to find the point that was causing the error by check the error details in the Chrome dev toolbar console , this will give you the functions in the call stack, and guide you towards the recursion that’s causing the error.
 

Public
Dmytro Zvazhii Flexmonster April 14, 2020

Hello,
Thank you for sharing your recommendations.
The provided suggestions can also be useful when it comes to either debugging or avoiding “Maximum call stack size exceeded” exception.
Please let us know in case of any other question.
Regards,
Dmytro

Please login or Register to Submit Answer