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

specifying a scope-name with unescaped quote in name gives LCB_ERR_KVENGINE_INVALID_PACKET

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.0.6
    • None
    • lcb, library
    • None
    • 1

    Description

      Update:  The problem was the erroneous back-quote in the scope name.
      sampleBucket.scope("userData`");
      Other types of errors in the name give the correct "scope not found". 

      -----------------------------------------------------------------------

      Using a collection name that is not default (or explicity _default)  with a back-quote embedded in it gives
      Error: LCB_ERR_KVENGINE_INVALID_PACKET (1031): A badly formatted packet was sent to the server.The first is sampleColl, it works fine. The second is sampleColl2 - it gives the error.------------
      Collection {
       _scope: Scope {
        _bucket: Bucket

      {    _cluster: [Cluster],    _name: 'travel-users',    _conn: [Connection]   }

      ,
        _name: '_default',
        _conn: Connection {
         _inst: CbConnection {},
         _pendOps: [],
         _pendBOps: [],
         _connected: false,
         _opened: true
        }
       },
       _name: '_default',
       _conn: Connection {
        _inst: CbConnection {},
        _pendOps: [],
        _pendBOps: [],
        _connected: false,
        _opened: true
       }
      }
      ------------
      Collection {
       _scope: Scope {
        _bucket: Bucket

      {    _cluster: [Cluster],    _name: 'travel-users',    _conn: [Connection]   }

      ,
        _name: 'userData`',
        _conn: Connection {
         _inst: CbConnection {},
         _pendOps: [],
         _pendBOps: [],
         _connected: false,
         _opened: true
        }
       },
       _name: 'users',
       _conn: Connection {
        _inst: CbConnection {},
        _pendOps: [],
        _pendBOps: [],
        _connected: false,
        _opened: true
       }
      }
      ------------

      [Error: LCB_ERR_KVENGINE_INVALID_PACKET (1031): A badly formatted packet was sent to the server. Please report this in a bug] {

        code: 1031,

        ctxtype: 'kv',

        status_code: 4,

        opaque: 0,

        cas: CbCas

      { '0': <Buffer 00 00 00 00 00 00 00 00> }

      ,

        key: 'user_77',

        bucket: 'travel-users',

        collection: '',

        scope: '',

        context: '',

        ref: ''

      }

      upsert failed with Error: LCB_ERR_KVENGINE_INVALID_PACKET (1031): A badly formatted packet was sent to the server. Please report this in a bug

      const sampleCluster = new couchbase.Cluster("
      http://localhost
      ", options);
      const sampleBucket = sampleCluster.bucket("travel-users");var sampleScope = sampleBucket.scope("_default");
      var sampleColl = sampleScope.collection("_default"); var sampleScope2 = sampleBucket.scope("userData`");
      var sampleColl2 = sampleScope2.collection("users"); console.log("------------");
      console.log(sampleColl);
      console.log("------------");
      console.log(sampleColl2);
      console.log("------------");// #tag::opencollections[] var result;
      var user=request.query.k ? request.query.k : 'user_77';
      try

      { // ensure 'user_77' works. Others will return doc not found var collDocument; collDocument =

      { id:'77', type:'user', first : 'Davey', last:'Crockett'}

      ;
      var smthing = await sampleColl2.upsert('user_77', collDocument,
      // new Options()._cas(cas)._timeout(5000), // 5 seconds
      (err, res) =>

      { if(err) console.log(err); if(res) console.log(res); }

      ).catch((e) =>

      { console.log("upsert failed with "+e) }

      );

      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
              michael.reiche Michael Reiche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty