Uploaded image for project: 'Couchbase node.js Client Library'
  1. Couchbase node.js Client Library
  2. JSCBC-724

No error message in terminal when cluster is offline for Node.js SDK 3.0.1

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Major
    • None
    • 3.0.1
    • lcb, library
    • None
    • 1
    • SDK 44: Txns, SDK 3.1, Docs

    Description

      Summary

      It appears that no error message is given in the terminal when running the following line whilst the cluster is completely offline:

      const getResult = await cluster.query(`SELECT * from ${BUCKET_NAME}`)
      

      We would expect for an error message to be shown in the terminal to reflect the fact that the cluster is offline, but nothing is shown in this instance. 

      If we replace the above line with:

      const getResult = await collection.get(`${KEY}`);
      

      Then we do get an error message shown in the terminal, as we would expect for the other line:

      Error: cluster object was closed
      

        

      Steps to Reproduce

      • Create a 1 node cluster on 6.0.3 running Data/Index/Query services
      • Create a Couchbase bucket called "bucket1"
      • Add a document with key = "doc1"
      • Create primary index for bucket1
      • Take the cluster offline (eg. vagrant halt)
      • Copy the following into a Node JS file and run, adjusting cluster address and log in credentials as necessary:

      const BUCKET_NAME = 'bucket1';
      const KEY = 'doc1'const couchbase = require('couchbase');try {
          var cluster = new couchbase.Cluster(
              'http://10.112.193.101:8091', {
                  username: 'Administrator',
                  password: 'password'});
          var bucket = cluster.bucket(BUCKET_NAME);
          var collection = bucket.defaultCollection();
          var binaryCollection = collection.binary();    (async function(){
              try {
                  const getResult = await cluster.query(`SELECT * from ${BUCKET_NAME}`)
                  console.log(getResult);
              } catch (e){
                  console.log(e);
              }
          })();} catch (e){
          console.log(e);
      }
      

      * Observe that no error message is given on the terminal 

      • Replace the line:

      const getResult = await cluster.query(`SELECT * from ${BUCKET_NAME}`);
      

      with the following:

      const getResult = await collection.get(`${KEY}`);

       

      • Rerun the code and observe that an "Error: cluster object was closed" message is now shown on the terminal

       

      Expected Results

      We would expect an error message to be shown in the terminal in both instances to reflect that the cluster is offline.

       

      Actual Results

      • An "Error: cluster object was closed" message is shown on the terminal when using the following line: 

      const getResult = await collection.get(`${KEY}`);

      * No message is shown when using the following line:

      const getResult = await cluster.query(`SELECT * from ${BUCKET_NAME}`)
      

       

      Attachments

        Issue Links

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

          Activity

            People

              brett19 Brett Lawson
              callum.majumdar Callum Majumdar
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty