hoodie icon indicating copy to clipboard operation
hoodie copied to clipboard

Unable to store data on CouchDB v2.2.0

Open ooii opened this issue 5 years ago • 3 comments

Hi,

I followed tutorial by @pmbanugo about phone book creation. It's working fine. Now, I want to store data on a CouchDB. I'm running a v2.2.0 database running on the same network as hood.ie. Here is the package.json file:

{
  "name": "hoodie-phonebook",
  "version": "1.0.0",
  "description": "a simple phonebook application for managing contacts",
  "scripts": {
    "start": "hoodie",
    "test": "echo \"Error: no test specified\" && exit 1",
    "start-hoodie": "hoodie"
  },
  "author": "Peter Mbanugo",
  "license": "ISC",
  "dependencies": {
    "hoodie": "^24.2.5"
  },
  "hoodie": {
    "address": "0.0.0.0",
    "port": 8080,
    "data": ".hoodie",
    "public": "public",
    "dbUrl": "http://192.168.1.2:5984",
    "dbUrlUsername" : "hoodie",
    "dbUrlPassword" : "hoodiepass",
    "dbAdapter": "pouchdb-adapter-http",
    "inMemory": false,
    "loglevel": "warn",
    "url": "",
    "adminPassword": "",
    "name": "my-hoodie-app"
  }
}

When I run npm start -- --loglevel=verbose I have the following message.

verb app Initialising
/private/tmp/hoodie-phonebook/node_modules/hoodie/bin/start.js:9
    throw error
    ^

Error: Authentication details missing from database URL: http://192.168.1.2:5984

If I include dbUrlUsername and dbUrlPassword in dbUrl, I have this message.

verb app Initialising
info hapi plugins registered
verb log 2019-09-05T09:29:46.960Z [ 'store', 'sill', 'deprecation' ] Checking if migration required for server.plugins.store.api usage (hoodiehq/hoodie-server#507)
verb log 2019-09-05T09:29:47.321Z [ 'store', 'sill', 'deprecation' ] No migration required for server.plugins.store.api usage
/private/tmp/hoodie-phonebook/node_modules/hoodie/bin/start.js:9
    throw error
    ^

Error: Could not set necessary CouchDB config
    at Request._callback (/private/tmp/hoodie-phonebook/node_modules/@hoodie/server/lib/config/db/couchdb-set-config.js:10:23)

What am I missing here? Thanks.

ooii avatar Sep 05 '19 09:09 ooii

Maybe @gr2m or @janl can help out? I don't have any local couchdb installed. I've used Cloudant and it has worked for me.

pmbanugo avatar Sep 05 '19 10:09 pmbanugo

Can you try http://localhost:5984 instead of http://192.168.1.2:5984?

It's been a very long time since I looked into this. The error

Authentication details missing from database

suggests that maybe the adminPassword needs to be set?

If you open http://192.168.1.2:5984, what credentials do you use to login with? Should be admin and a password. Set that password in your package.json

gr2m avatar Sep 05 '19 22:09 gr2m

Can you try http://localhost:5984 instead of http://192.168.1.2:5984?

It is not hosted on the same machine but I tried to run this phonebook app on the same machine running the database and I'm receiving the exact same message.

Authentication details missing from database

suggests that maybe the adminPassword needs to be set?

I added one and also a url but still same message

verb app Initialising
info hapi plugins registered
verb log 2019-09-06T08:33:54.983Z [ 'store', 'sill', 'deprecation' ] Checking if migration required for server.plugins.store.api usage (hoodiehq/hoodie-server#507)
verb log 2019-09-06T08:33:55.495Z [ 'store', 'sill', 'deprecation' ] No migration required for server.plugins.store.api usage
/private/tmp/hoodie-phonebook/node_modules/hoodie/bin/start.js:9
    throw error
    ^

Error: Could not set necessary CouchDB config
    at Request._callback (/private/tmp/hoodie-phonebook/node_modules/@hoodie/server/lib/config/db/couchdb-set-config.js:10:23)
    at Request.self.callback (/private/tmp/hoodie-phonebook/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.<anonymous> (/private/tmp/hoodie-phonebook/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:198:13)
    at IncomingMessage.<anonymous> (/private/tmp/hoodie-phonebook/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

ooii avatar Sep 06 '19 08:09 ooii