Closed monte-hayward closed 7 years ago
This is just a very light wrapper around nano anyway actually. The initial function call takes the same configuration as nano. So for auth you would specify it in the url
const storage = require("botkit-storage-couchdb")("https://username:password@couchprovider.com");
The original error was solved by your suggestion of putting un:pw@host into the one param url
.
This gets me to the next error. turns out it can be worked-around by handing the command any function.
controller.storage.teams.save(TEAM); // results in error below
controller.storage.teams.save(TEAM, log); // no error
info: ** Serving oauth return endpoint: http://0.0.0.0:8082/oauth
{ Error: missing
at Request._callback (/path/to/node_modules/nano/lib/nano.js:248:15)
at Request.self.callback (/path/to/node_modules/request/request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/path/to/node_modules/request/request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/path/to/node_modules/request/request.js:1091:12)
at IncomingMessage.g (events.js:291:16)
name: 'Error',
error: 'not_found',
reason: 'missing',
scope: 'couch',
statusCode: 404,
request:
{ method: 'GET',
headers:
{ 'content-type': 'application/json',
accept: 'application/json' },
uri: 'https://XXXXXX:XXXXXX@GUID-bluemix.cloudant.com/dbname/teams%2FID' },
headers:
{ 'cache-control': 'must-revalidate',
connection: 'close',
'content-type': 'application/json',
date: 'Wed, 03 May 2017 17:13:54 GMT',
'x-couch-request-id': '788123631f',
'x-couchdb-body-time': '0',
'x-content-type-options': 'nosniff',
'x-cloudant-backend': 'bm-cc-dal-01',
via: '1.1 lb1.bm-cc-dal-01 (Glum/1.34.0)',
'strict-transport-security': 'max-age=31536000',
statusCode: 404,
uri: 'https://XXXXXX:XXXXXX@GUID-bluemix.cloudant.com/dbname/teams%2FID },
errid: 'non_200',
description: 'couch returned 404' }
/path/to/node_modules/botkit-storage-couchdb/lib/storage.js:27
done(null, body.id);
^
TypeError: done is not a function
at /path/to/node_modules/botkit-storage-couchdb/lib/storage.js:27:13
at Request._callback (/path/to/node_modules/nano/lib/nano.js:217:16)
at Request.self.callback (/path/to/node_modules/request/request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/path/to/node_modules/request/request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/path/to/node_modules/request/request.js:1091:12)
at IncomingMessage.g (events.js:291:16)
Process finished with exit code 1
I did not see a username/password/auth configuration. Is there a way to add the needed credentials without rolling my own solution with request/nano? Thanks