Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn on missing credentials to access a restricted couch database #11

Open
maxlath opened this issue Aug 6, 2016 · 2 comments
Open

Comments

@maxlath
Copy link
Contributor

maxlath commented Aug 6, 2016

for couch databases with a security document restricting the access, starting to sync without passing an admin username and password as Basic Auth in the database url (ex: http://username:pwd@localhost:5984/foo) results in couch2elastic4sync exiting silently, which looks a lot like a "everything went fine" behavior. The easiest fix I can see would be to log the error message returned by couchdb:

{"error":"unauthorized","reason":"You are not authorized to access this db."}
@ryanramage
Copy link
Owner

@maxlath
Copy link
Contributor Author

maxlath commented Aug 20, 2016

With a secured db but a url without Basic Auth:

  • couch2elastic4sync --config=config.json load ends without logging anything (silently failing)
  • couch2elastic4sync --config=config.json logs the following:
{"name":"couch2elastic4sync","hostname":"myhostname","pid":23086,"level":50,"msg":"an error occured no seq number in elasticsearch at http://localhost:9200/inventaire/_mapping/seq","time":"2016-08-20T17:55:04.579Z","v":0}
{"name":"couch2elastic4sync","hostname":"myhostname","pid":23086,"level":30,"msg":"since: now","time":"2016-08-20T17:55:04.581Z","v":0}
{"name":"couch2elastic4sync","hostname":"myhostname","pid":23086,"level":30,"msg":"endOnCatchup: false","time":"2016-08-20T17:55:04.581Z","v":0}
{"name":"couch2elastic4sync","hostname":"myhostname","pid":23086,"level":50,"err":{"message":"Bad DB response: {\"error\":\"unauthorized\",\"reason\":\"You are not authorized to access this db.\"}\n","name":"Error","stack":"Error: Bad DB response: {\"error\":\"unauthorized\",\"reason\":\"You are not authorized to access this db.\"}\n\n    at Request.db_response [as _callback] (/home/maxlath/.nvm/versions/node/v4.4.5/lib/node_modules/couch2elastic4sync/node_modules/follow/lib/feed.js:146:33)\n    at Request.self.callback (/home/maxlath/.nvm/versions/node/v4.4.5/lib/node_modules/couch2elastic4sync/node_modules/follow/node_modules/request/request.js:368:22)\n    at emitTwo (events.js:87:13)\n    at Request.emit (events.js:172:7)\n    at Request.<anonymous> (/home/maxlath/.nvm/versions/node/v4.4.5/lib/node_modules/couch2elastic4sync/node_modules/follow/node_modules/request/request.js:1219:14)\n    at emitOne (events.js:82:20)\n    at Request.emit (events.js:169:7)\n    at IncomingMessage.<anonymous> (/home/maxlath/.nvm/versions/node/v4.4.5/lib/node_modules/couch2elastic4sync/node_modules/follow/node_modules/request/request.js:1167:12)\n    at emitNone (events.js:72:20)\n    at IncomingMessage.emit (events.js:166:7)"},"msg":"Bad DB response: {\"error\":\"unauthorized\",\"reason\":\"You are not authorized to access this db.\"}\n","time":"2016-08-20T17:55:04.782Z","v":0}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants