Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-1593

certPath param in sdk 3 vs sdk 2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Major
    • None
    • None
    • None
    • None

    Description

      The certpath seems to be quite different from the previous version. It seems that the certpath needs to be a directing containing pem files, and the pem files must have the name given in the cluster.bucket(...) call (which would normally be the bucketname, but it doesn't seem to matter, as long as the pem file with that name exists)
      connecting-ssl.js 
      // Require Couchbase Module
      var couchbase = require('couchbase');

      // Require Couchbase Module
      var couchbase = require('couchbase');

      /*

      • Put Self-Signed Cluster Certificate from the cluster
      • $ curl http://localhost:8091/pools/default/certificate -o /tmp/junk.pem
        */

        // Setup Cluster Connection Object - must include the bucket name
        // incorrect bucket name here will get you BUCKET_NOT_FOUND

        var connString = 'couchbases://127.0.0.1/travel-sample?certpath=/tmp';

        // Setup Cluster Connection Object

        const options = {username: 'Administrator', password: 'password'}

        ;
        var cluster = new couchbase.Cluster(connString,options);

        // Setup Bucket object to be reused within the code
        //
        // specify bucket again. Actually this does appear to be used for the
        // name of the bucket. It must be the name of the pem file withing
        // the certpath directory.
        // Mess that up and you will get a generic SSL ERROR
        //
        const bucket = cluster.bucket("junk.pem"); // specify bucket (again)
        const collection = bucket.defaultCollection();
        const docKey='airport_1254';

        try {
        res= collection.get(docKey,

        {timeout:10}

        ,
        (err,res)=>

        { if(res)console.log("================== res: "+JSON.stringify(res)); if(err)console.log("================== err: "+err); }

        ).catch((e)=>

        {done=true; console.log(e)}

        );
        }catch(e)

        { e.printStackTrace(); }

        console.log(" ***************** press control-c to exit ***************");
        var http = require('http');
        http.createServer(function (req, res) {
        res.writeHead(200,

        {'Content-Type': 'text/plain'}

        );
        res.write('Hello World!');
        res.end();
        }).listen(8080);
         

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            daschl Michael Nitschinger
            michael.reiche Michael Reiche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty