cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

range error invalid string length at json.stringify

0 Kudos
5,377

Hi ,

I am facing issue at this line in my xsjs file

$.response.setBody(JSON.stringify(result));

ERROR MSG:range error invalid string length at json.stringify



Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor
0 Kudos

As mentioned in the comments above, the error ususally appears because runnining into a memory issue.

You can try

  • to process the serialization of your large array in chunks (e.g. if you have 1000 entries in your array, to a stepwise serialization per 100 entries for instance and concatenate the result).
  • increase the memory of your node process aka application (assuming you are using an XSA node module). You can do that via the deployment descriptor or manually (for test reasons) via the SAP HANA XSA Cockpit or the XS CLI (check the scaling options for memory here)