I was trying to find/report on a bug in your SDK.
Your SDK is crashing my process in the case that I make a connection to remote couchbase and querying it with N1QL. If the query takes a long time and maybe the connection is lost due to connectivity issues, then eventually you return “timeout” answer but you return it with chunks and then try to JSON.parse on the last chunk, which obviously fails and crashes the process.
First of all, never crash a process in a SDK. Always throw an error back to the developer so he can handle any such errors and keep his application alive.
Secondly, why fail at all? Aggregate the chunks and parse at the end.