When running the following code inside my app.js, connecting to Couchbase server running on Amazon EC2, i get the following error
{ [CouchbaseError: Operation not supported] message: ‘Operation not supported’, code: 19 }
This error also occurs when i try to run a GET command
var express = require("express");
var bodyParser = require("body-parser");
var couchbase = require("couchbase");
var ottoman = require("ottoman");
// Setup the framework
var app = express();
// Setup body parser to handle JSON requests
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
// Setup connection
var cluster = new couchbase.Cluster("couchbase://my-amazon-instance.compute-1.amazonaws.com");
var bucket = cluster.openBucket("example",function(err){
if(err){
console.log("Can't open bucket");
throw err;
}
else {
console.log("Successfully opened bucket");
}
});
// Prevent timing out
bucket.operationTimeout = 8000;
// This exposes bucket to other files in the project
module.exports.bucket = bucket;
// Include routes in bootstrapping
// Parse the initialize framework object (app)
var routes = require("./routes.js")(app);
// Tell Ottoman to use our buckets
ottoman.bucket = bucket;
// Ensure that ottoman uses its own indexes
ottoman.ensureIndices(function(error){
if(error){
console.log(error)
}
var server = app.listen(3000, function(){
console.log("Listening on port %s...", server.address().port);
})
})
@matthew.groves just before the server starts at this line:
if(error){
console.log(error)
}
var server = app.listen(3000, function(){
console.log(“Listening on port %s…”, server.address().port);
})
Can you confirm what version of Couchbase Server you are running, along with the cluster topology (how many servers, which services are enabled on each, for instance, are you sure the N1QL service is enabled on your cluster?). The main reason you would get Operation Not Supported is if you attempt to perform an operation which cannot be completed by the underlying libcouchbase library, a few examples of cases which might cause this:
Attempting to use SSL without a SSL-enabled libcouchbase (the bundled libcouchbase does not support it due to Node.js compatibility reasons).
Attempting to use N1QL without any N1QL services in your cluster.
Attempting to use a newer Node.js SDK with an older install of libcouchbase (via --couchbase-root), this fails since the Node.js SDK might internally use APIs which are not available in an older libcouchbase.
Attempting to use Couchbase operations on a Memcached bucket (this is less likely since your example code shouldn’t be performing any non-http operations).
Attempting to use SSL without a SSL-enabled libcouchbase (the bundled libcouchbase does not support it due to Node.js compatibility reasons). - The connect is not SSL
Attempting to use N1QL without any N1QL services in your cluster. - I am not doing this as far as i know
Attempting to use a newer Node.js SDK with an older install of libcouchbase (via --couchbase-root), this fails since the Node.js SDK might internally use APIs which are not available in an older libcouchbase. - What version of Node is compatible with the Sync gateway version 2.5.5 + 1.1.0 ?
Should i rather use this one:
Attempting to use Couchbase operations on a Memcached bucket (this is less likely since your example code shouldn’t be performing any non-http operations). - The bucket is not memcached
Looks like the likely problem is the fact that you are using Couchbase Server 2.5.2. Ottoman internally attempts to create a N1QL primary index to support generic finds (the ability to arbitrarily search model properties). Unfortunately due to an oversight it does this indiscriminately without any regard for the fact that you do not have N1QL available. I will look into a solution for this.
@brett19, Thanks alot for the response, i couldn’t understand what was going on as i am running 4.6 enterprise edition on my local. Please keep me posted on the workaround.
@ingenthr I have upgraded my couchbase server to 4.0
I am no longer getting the error 19
But i am now getting a timeout error, when creating the indexes
Error: An unknown N1QL error occured. This is usually related to an out-of-memory condition.
Working with couchbase has been a relatively frustrating experience i must say.
Thanks alot @ingenthr opening port 8093 fixed my problem and everything seems to be working perfectly now!!!
Well, part of the reason i could have ended up with such an old version is because it shipped with sync gateway and since i am no server admin or couchbase expert, i opted to install that one to my own disadvantage but i am glad because i have learnt alot in the process thanks to the awesome support from you guys here.
@ingenthr@brett19 would you be able to point me to resources that can guide me on how to install sync gateway on an AWS EC2 instance, either in this community or externally.
Sync Gateway uses ports 4984 and 4985 by default. You can configure this. Just pointing that out so you open the right ports. 4985 is the admin port, so you may not want that open to the world.
Let us know what other questions you have. Also tagging @traun who is the AMI expert. If you have more questions on mobile (Couchbase Lite and Sync Gateway), better to post under the mobile category.
@hod.greeley thanks alot for the information. I have since installed the newer AMI with Sync Gateway and CB Server 4+ and i am no longer experiencing the issues i have been facing.
I do have additional Couchbase Lite and sync gateway questions which i will post in the mobile category as advised.
@traun once i install the AMI, i remote into the instance via ssh and run: sudo netstat -nlp | grep :4984
I can see that my sync gateway is running on port 4984 as i get the response:
tcp 0 0 :::4984 :::* LISTEN 2356/sync_gateway
My questions are:
How do i monitor the incoming connections and activity on the sync gateway via the browser ?
I have read that 4985 is the “Admin” port, how do i access this either via the browser or otherwise?
Thanks again to the entire couchbase team for the excellent support your help.