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

Connection strings with several hosts throw ERR_INVALID_URL error #664

Closed
sigalor opened this issue Apr 1, 2022 · 1 comment
Closed
Labels

Comments

@sigalor
Copy link

sigalor commented Apr 1, 2022

Steps to reproduce

Consider this connection string:

mongodb://root:xxxxx@db-host-0-service.default.svc.cluster.local:27017,db-host-0-service.default.svc.cluster.local:27017/my-database?authSource=admin&replicaSet=rs

It contains several hosts, separated by commas, which is of course allowed according to MongoDB's Connection String URI Format. Yet, due to commit 1d8a84b, where the library tries to parse this connection string via the new URL(...) constructor, initializing fails.

Current Behavior

When supplying such a connection string with multiple hosts, an error is thrown: TypeError [ERR_INVALID_URL]: Invalid URL: ..., because the URL constructor cannot handle several hosts separated by commas in one URL.

Expected Behavior

No error is thrown.

@sigalor sigalor added the bug label Apr 1, 2022
@sigalor
Copy link
Author

sigalor commented Apr 1, 2022

Sorry, duplicate of #663.

@sigalor sigalor closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant