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
,
_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
,
_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) =>
).catch((e) =>
{ console.log("upsert failed with "+e) });
Attachments
Issue Links
- is caused by
-
CCBC-1189 scope with quote in name gives LCB_ERR_KVENGINE_INVALID_PACKET
- Resolved