Closed ftomassetti closed 2 months ago
Instead of using JSON.stringify
on the whole response, you could use JSON.stringify
on separate serialized nodes, and then concatenate them into a Buffer
“by hand”.
Do you know what it is trying to send? A correct response? Or an error?
Do you know what it is trying to send? A correct response? Or an error?
I am trying to send a correct response which happens to list hundreds of thousands if not millions of IDs
Stringify produces
RangeError: Invalid string length
on calls torespond.send(somevalue)
as it internally seems to useJSON.stringify
.Perhaps we could avoid this by serializing to JSON using other libraries and then pass a String (see for example https://stackoverflow.com/questions/591857/how-can-i-get-a-javascript-stack-trace-when-i-throw-an-exception)