Unable to connect to database. Possibly SDK issue


#1

Hello,

I’m new to Node JS and Couchbase as a Document database. I used an example found on a blog article (https://blog.couchbase.com/use-aws-lambda-api-gateway-node-js-couchbase-nosql/). However, when attempting to call any of the functions, I am receiving the below error.


"errorMessage": "Error while loading retrieve",

“errorType”: “TypeError”,
“stackTrace”: [
“TypeError: Cannot read property ‘username’ of undefined”,
“at new Cluster (/Users/user/Documents/Projects/affinity/node_modules/couchbase/lib/cluster.js:46:31)”,
“at Object. (/Users/user/Documents/Projects/affinity/handler.js:7:15)”,
“at Module._compile (internal/modules/cjs/loader.js:816:30)”,
“at Object.Module._extensions…js (internal/modules/cjs/loader.js:827:10)”,
“at Module.load (internal/modules/cjs/loader.js:685:32)”,
“at Function.Module._load (internal/modules/cjs/loader.js:620:12)”,
“at Module.require (internal/modules/cjs/loader.js:723:19)”,
“at require (internal/modules/cjs/helpers.js:14:16)”,
“at Object.createHandler (/Users/user/Documents/Projects/affinity/node_modules/serverless-offline/src/functionHelper.js:192:17)”,
“at handler (/Users/user/Documents/Projects/affinity/node_modules/serverless-offline/src/index.js:609:40)”,
“at Object.internals.handler (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/handler.js:101:51)”,
“at request._protect.run (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/handler.js:32:23)”,
“at module.exports.internals.Protect.internals.Protect.run (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/protect.js:60:12)”,
“at exports.execute (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/handler.js:26:22)”,
“at each (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/request.js:401:16)”,
“at iterate (/Users/user/Documents/Projects/affinity/node_modules/items/lib/index.js:36:13)”,
“at done (/Users/user/Documents/Projects/affinity/node_modules/items/lib/index.js:28:25)”,
“at module.exports.internals.Auth.internals.Auth._authenticate (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/auth.js:222:16)”,
“at internals.Auth.authenticate (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/auth.js:197:17)”,
“at each (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/request.js:401:16)”,
“at iterate (/Users/user/Documents/Projects/affinity/node_modules/items/lib/index.js:36:13)”,
“at done (/Users/user/Documents/Projects/affinity/node_modules/items/lib/index.js:28:25)”,
“at internals.state (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/route.js:292:16)”,
“at each (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/request.js:401:16)”,
“at iterate (/Users/user/Documents/Projects/affinity/node_modules/items/lib/index.js:36:13)”,
“at Object.exports.serial (/Users/user/Documents/Projects/affinity/node_modules/items/lib/index.js:39:9)”,
“at internals.Request._lifecycle (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/request.js:404:18)”,
“at internals.Request._match (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/request.js:381:17)”,
“at internals.Request._execute (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/request.js:335:21)”,
“at Domain.request._protect.enter (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/connection.js:275:25)”,
“at Domain.run (domain.js:369:14)”,
“at module.exports.internals.Protect.internals.Protect.enter (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/protect.js:76:17)”,
“at Server. (/Users/user/Documents/Projects/affinity/node_modules/hapi/lib/connection.js:273:30)”,
“at Server.emit (events.js:193:13)”,
“at Server.EventEmitter.emit (domain.js:481:20)”,
“at parserOnIncoming (_http_server.js:680:12)”
],


Node version is 11.14.0.

I have confirmed the credentials specified within the handler file is correct and I can login as the user and read from the bucket. Please let me know if anything else is needed. Any help will be greatly appreciated.


#2

Anyone have any suggestions?


#3

Try downgrade to 2.5 by ‘npm install couchbase@2.5’. It seems version 2.6 has some issue.
-Jae