hoodiehq / hoodie-server

:dog: Hapi plugin for Hoodie’s server core module
Apache License 2.0
243 stars 47 forks source link

forgetting a trailing slash for cloudant dbUrl crashes with hard to decipher error #542

Open dominicbarnes opened 6 years ago

dominicbarnes commented 6 years ago

Currently, if you use a Cloudant backend along with a dbUrl config that is missing a / at the end, you'll end up with an error like this:

Error: getaddrinfo ENOTFOUND c38aeb6d-2e18-40ca-b7e9-404da06abd39-bluemix.cloudant.comhoodie-config c38aeb6d-2e18-40ca-b7e9-404da06abd39-bluemix.cloudant.comhoodie-config:443

The fix is ensuring the URL has a / appended, and this appears to be caused by this "hack". In my case, it ended up making the db hostname <account>.cloudant.comhack, which triggers the above DNS lookup error.

Possible solutions here include:

gr2m commented 6 years ago

can you share your exact setup, leaving out the password of course? I was not able to reproduce the problem with @hoodie/server myself

gr2m commented 6 years ago

oh could it be we run into https://github.com/pouchdb/pouchdb/issues/5814#issuecomment-347981790? PouchDB is a great project to contribute to as well, happy to help out if you get stuck