Error when querying a remote N1ql engine with https

Alright, so I have a couple apps that are running on their own servers, each of which is connecting to a dedicated couchbase server with couchbase-server itself and cbq-engine running on it.

Previously, I was able to connect to cbq-engine on the server with the node.js sdk, using port 8093:

/* ...setup the bucket... */
/* ...perform an n1ql query and stuff against the bucket... */

That worked. However, just having the query interface open to the whole wide world seems insecure. So, the server was switched to forward requests to cb-engine through https, without using port 8093.

/* ...setup the bucket... */

var query = "SELECT 'Test' AS test";
query = require('couchbase').N1qlQuery.fromString(query);

bucket.query(query, function(err, results) {
  if (err) console.trace(err);
  /* ... */

This did not work, and instead the query call had this error and stack-trace:

Trace: { message: 'Invalid input/arguments', code: 7 }
    at Array.3 (/home/test-project/index.js:15:26)
    at Bucket._invoke (/home/test-project/node_modules/couchbase/lib/bucket.js:815:24)
    at Bucket._maybeInvoke (/home/test-project/node_modules/couchbase/lib/bucket.js:832:10)
    at Bucket._n1ql (/home/test-project/node_modules/couchbase/lib/bucket.js:678:8)
    at Bucket.query (/home/test-project/node_modules/couchbase/lib/bucket.js:723:17)
    at Bucket.<anonymous> (/home/test-project/index.js:14:12)
    at Bucket.EventEmitter.emit (events.js:117:20)
    at Bucket.<anonymous> (/home/test-project/node_modules/couchbase/lib/bucket.js:178:10)

It’s pretty cryptic, so I haven’t had much to go on. However, to try and eliminate the server as the cause of the problem, I connected with cbq and ran the same test:

$cbq -engine=
cbq> SELECT 'Test' AS test;
    "requestID": "560a207a-c902-4c31-8b35-33cbe539b119",
    "signature": {
        "test": "string"
    "results": [
            "test": "Test"
    "status": "success",
    "metrics": {
        "elapsedTime": "488.863us",
        "executionTime": "401.148us",
        "resultCount": 1,
        "resultSize": 38

So, cbq itself works, but not the node.js sdk when trying to query. Any thoughts as to what might be causing this, or workarounds?

More info:
Node Version: 0.10.26
Couchbase package version: 2.0.8

2.0.8 moved to using libcouchbase for n1ql support. This means it obtains the map of cluster services from the cluster itself, and will only work with the integrated N1QL service in the developer preview service in Couchbase itself. The standalone N1QL developer preview will no longer work with this new version.

Currently I’d recommend making your own https connection using node.js’s built-in http functionality, rather than trying to employ the SDK for this; in a future version Couchbase might offer SSL-enabled N1QL access, but this is not yet present in the current beta and dp.

Thanks, that solution worked.