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

Cannot connect to mongodb #20

Open
nahsi opened this issue Jan 14, 2022 · 3 comments
Open

Cannot connect to mongodb #20

nahsi opened this issue Jan 14, 2022 · 3 comments

Comments

@nahsi
Copy link

nahsi commented Jan 14, 2022

MONGODB_URL='mongodb://<username>:<password>@mongo-primary.service.consul:27017,mongo-secondary.service.consul:27017/ducky-api?tls=true&tlsCertificateKeyFile=/secrets/certs/bundle.pem&tlsCAFile=/secrets/certs/CA.pem'

Other software from wildduck stack connects just fine with similar mongodb url

MongoError: database names cannot contain the character '.'
    at Function.create (/usr/local/ducky-api/node_modules/mongodb/lib/core/error.js:57:12)
    at validateDatabaseName (/usr/local/ducky-api/node_modules/mongodb/lib/operations/db_ops.js:344:24)
    at new Db (/usr/local/ducky-api/node_modules/mongodb/lib/db.js:190:3)
    at MongoClient.db (/usr/local/ducky-api/node_modules/mongodb/lib/mongo_client.js:318:14)
    at MigrationExecutor.<anonymous> (/usr/local/ducky-api/node_modules/typeorm/migration/MigrationExecutor.js:470:34)
    at step (/usr/local/ducky-api/node_modules/typeorm/node_modules/tslib/tslib.js:141:27)
    at Object.next (/usr/local/ducky-api/node_modules/typeorm/node_modules/tslib/tslib.js:122:57)
    at /usr/local/ducky-api/node_modules/typeorm/node_modules/tslib/tslib.js:115:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/usr/local/ducky-api/node_modules/typeorm/node_modules/tslib/tslib.js:111:16)```
@louis-lau
Copy link
Owner

This error seems to be coming from the mongodb driver itself. As far as I know that entire string has nothing changed to it and is passed to the mongodb driver as is. Sorry, but I have no solution for you. Are you really sure it's valid?

@nahsi
Copy link
Author

nahsi commented Jan 16, 2022

@louis-lau yep, pretty sure. zone-mta, haraka, wildduck have (almost) same string.

I will try digging into it, enabling all sorts of debug logs etc and will get back if I found anything, in case anyone else has the same issue.

@nahsi
Copy link
Author

nahsi commented Jan 16, 2022

What I managed to find so far is that it works without TLS, i.e. with a string like this:

MONGODB_URL='mongodb://<username>:<password>@mongo-primary.service.consul:27017,mongo-secondary.service.consul:27017/ducky-api'

Dots that it didn't like were from bundle.pem and CA.pem in URL params. So this is probably a bug.

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