Sending "postdata" for view queries

The Couchbase SDK enforces a maximum length of 2048 characters on the serialised, url-encoded query parameters string passed to Couchbase to perform a view query. We have several queries in our system where our serialised query options may exceed the 2048 character limit due to large sets of keys. If this limit is crossed the C SDK will return an LCB_E2BIG error saying “The object requested is too big to store in the server”. The solution to this appears to be to perform the query as a POST request and send the list of keys in the view request body.

I note that the C SDK supports sending through POST data as a “postdata” and accompanying “npostdata” property in the lcb_CMDVIEWQUERY struct. However, there do not appear to be bindings to make this option available in the Node.js SDK.

Is there another way to perform a POST view query through the Node.js SDK or is there intent to support this in the near future?

Could we implement our own HTTP client to perform these view queries to overcome this issue? Are there any caveats to this approach?

Hey @tjdavey,

I will be looking into switching Node.js to using the POST method to avoid this limitation in the future.

Cheers, Brett

The Couchbase team released the first NPM release which will utilise POST to send the query options for the Node.js SDK. This is available from 2.3.7.

If you are impacted by the above issue you can now upgrade to utilise longer query options values.