LionWeb-io / lionweb-repository

Reference implementation of LionWeb repository
Apache License 2.0
2 stars 1 forks source link

Failure to send answer which is too large because stringify fails #49

Closed ftomassetti closed 2 months ago

ftomassetti commented 2 months ago

Stringify produces RangeError: Invalid string length on calls to respond.send(somevalue) as it internally seems to use JSON.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)

dslmeinte commented 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”.

joswarmer commented 2 months ago

Do you know what it is trying to send? A correct response? Or an error?

ftomassetti commented 2 months ago

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