Getting Error: parent cluster object has been closed
with Couchbase Node SDK v3
When on development I would get his error randomly and after restarting the server CB wouldn’t throw this error but now restarting also not a fix for this issue.
Error
Error: parent cluster object has been closed
at Connection._maybeFwd (E:\project\server\node_modules\couchbase\lib\connection.js:201:13)
at Connection.query (E:\project\server\node_modules\couchbase\lib\connection.js:305:10)
at QueryExecutor.query (E:\project\server\node_modules\couchbase\lib\queryexecutor.js:111:16)
at Cluster.query (E:\project\server\node_modules\couchbase\lib\cluster.js:294:24)
at _callee6$ (E:\project\server\database\couchbase\/index.js:106:36)
at tryCatch (E:\project\server\node_modules\@babel\node\node_modules\regenerator-runtime\runtime.js:63:40)
at Generator.invoke [as _invoke] (E:\project\server\node_modules\@babel\node\node_modules\regenerator-runtime\runtime.js:293:22)
at Generator.next (E:\project\server\node_modules\@babel\node\node_modules\regenerator-runtime\runtime.js:118:21)
at asyncGeneratorStep (E:\project\server\database\couchbase\index.js:14:103)
at _next (E:\project\server\database\couchbase\index.js:16:194)
Couchbase setup
const couchbase = require("couchbase");
const cluster = new couchbase.Cluster("couchbase://localhost/", {
username: "admin",
password: "admin123",
});
const bucket = cluster.bucket("ads");
const collection = bucket.defaultCollection();