I have encountered lots of issues with node js api to manage a cluster.
1-I can’t create a bucket. ClusterManager.createBucket always return an error “Error”.
I tried with REST api using the node builtin http module and get an invalid authentication error.
Finally got it working using the node module “request” to make a REST api call, so probably something is not working with the latest node 6.6 and http module and since I saw the node sdk also use raw http module, the problem is probably there.
2-After I created the bucket with the REST api, the openbucket return “CouchbaseError: Data received on socket was not in the expected format”, if it is being called on the same process".
If I rerun the script with the bucket already there, I can open the bucket just fine.
I am running Node JS 6.6 on Windows with the 2.2.3 sdk and connected to a Couchbase 4.5.1 server on a mac through local networking.
In case anybody else have the same error, I managed to solve problem 2 by adding a delay between the creating of the bucket and the connection. Probably was still initializing the bucket.
Problem one still persist and the only solution is to use the REST api with request module.
Regarding number 2, I also see this. Creating a bucket, then trying to open the bucket from the same process fails with the “not in the expected format” message. However, when rerunning the script with the bucket already created, I can open it without an error.
I am using the node.js SDK.
I initially tried adding a delay of 1 second between the two commands but it didn’t help. However, increasing this to 2 seconds does seem to fix this. I would guess that the bucket has not finished initialising or something after 1 second, although the cluseterManager.createBucket call returned before starting the delay. Is there an event or any other way to find out when the bucket is ready and can be opened rather than adding an arbitrary delay?