Page 1 of 1

RangeError: Invalid array length

Posted: Fri Nov 08, 2024 12:36 pm
by djjoyro
I receive this error (RangeError: Invalid array length) when calling report.savePackedDocumentToByteArray() on a report with around 500 rendered pages.
report.saveDocumentToJsonString() or report.saveDocumentFile() are working fine.
Stack trace looks like this:

Code: Select all

Exception has occurred: RangeError: Invalid array length
  at String.map (<anonymous>)
    at Q.toBytesArray (...\node_modules\stimulsoft-reports-js\Scripts\stimulsoft.reports.js:13:169724)
    at $S.getBytes (...\node_modules\stimulsoft-reports-js\Scripts\stimulsoft.reports.js:14:141527)
    at SM.savePackedDocumentToByteArray (...\node_modules\stimulsoft-reports-js\Scripts\stimulsoft.reports.js:45:117212)
Version 2024.3.3, but I can confir that the same error occurs on latest version also.
Is any other way to obtain the Byte array of the rendered report ?

Thank you.

Re: RangeError: Invalid array length

Posted: Mon Nov 11, 2024 5:21 pm
by Lech Kulikowski
Hello,

The issue is ocurs will all reports or specific.
Please send us a sample project that reproduces the issue for analysis on support@stimulsoft.com

Thank you.

Re: RangeError: Invalid array length

Posted: Tue Nov 12, 2024 12:16 pm
by djjoyro
Hello,

The problem seems to be caused by out of memory issue.
I have ended up splitting the rendered report in chunks of 100 pages and I savePackedDocumentToByteArray in batches like this.

At the client side, I take these batches, load into reports, and move the rendered pages to a mainReport.
This works without giving any error, but it takes several minutes to save the report.
If you have any suggestion for optimizing this, splitting to multiple processes, I would highly appreciate.

Thank you.

Re: RangeError: Invalid array length

Posted: Wed Nov 13, 2024 8:10 pm
by Lech Kulikowski
Hello,

Thank you for sharing your experience with other users.