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

Invalid mongodb connection string if CLEARML_MONGODB_SERVICE_CONNECTION_STRING is specified #252

Open
smartnet-club opened this issue Sep 16, 2024 · 4 comments

Comments

@smartnet-club
Copy link

CLEARML_MONGODB_SERVICE_CONNECTION_STRING=mongodb://myDBReader:D1fficultP%[email protected]:27017/?authSource=admin

expected connection string:
mongodb://myDBReader:D1fficultP%[email protected]:27017/auth?authSource=admin

actual connection string:
mongodb://myDBReader:D1fficultP%[email protected]:27017/?authSource=admin/auth

must be fixed database package
con_str = f"{override_connection_string.rstrip('/')}/{key}"

@ainoam
Copy link
Collaborator

ainoam commented Sep 16, 2024

Thanks for letting us know @smartnet-club - We'll take a look.

@evg-allegro
Copy link
Contributor

@smartnet-club We reproduced the issue. It will be fixed in the upcoming open source version (v1.17)

@pollfly
Copy link
Contributor

pollfly commented Dec 8, 2024

Hey @smartnet-club! Just letting you know that this issue has been resolved in the recently released v1.17.0. Let us know if there are any issues :)

@smartnet-club
Copy link
Author

Error parsing mongodb replica set connection string.

Connection string: "mongodb://user:password@host1:27017,host2:27017,host3:27017/database?replicaSet=myReplicaSet"

Error:

apiserver-1  | Traceback (most recent call last):
apiserver-1  |   File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
apiserver-1  |     return _run_code(code, main_globals, None,
apiserver-1  |   File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
apiserver-1  |     exec(code, run_globals)
apiserver-1  |   File "/opt/clearml/apiserver/server.py", line 10, in <module>
apiserver-1  |     AppSequence(app).start(request_handlers=RequestHandlers())
apiserver-1  |   File "/opt/clearml/apiserver/server_init/app_sequence.py", line 42, in start
apiserver-1  |     self._init_dbs()
apiserver-1  |   File "/opt/clearml/apiserver/server_init/app_sequence.py", line 72, in _init_dbs
apiserver-1  |     db.initialize()
apiserver-1  |   File "/opt/clearml/apiserver/database/__init__.py", line 84, in initialize
apiserver-1  |     con_str = furl(override_connection_string).add(path=key).url
apiserver-1  |   File "/usr/local/lib/python3.9/site-packages/furl/furl.py", line 1381, in __init__
apiserver-1  |     self.load(url)  # Raises ValueError on invalid URL.
apiserver-1  |   File "/usr/local/lib/python3.9/site-packages/furl/furl.py", line 1408, in load
apiserver-1  |     self.netloc = tokens.netloc  # Raises ValueError in Python 2.7+.
apiserver-1  |   File "/usr/local/lib/python3.9/site-packages/furl/furl.py", line 1889, in __setattr__
apiserver-1  |     object.__setattr__(self, attr, value)
apiserver-1  |   File "/usr/local/lib/python3.9/site-packages/furl/furl.py", line 1535, in netloc
apiserver-1  |     self.host = host
apiserver-1  |   File "/usr/local/lib/python3.9/site-packages/furl/furl.py", line 1889, in __setattr__
apiserver-1  |     object.__setattr__(self, attr, value)
apiserver-1  |   File "/usr/local/lib/python3.9/site-packages/furl/furl.py", line 1450, in host
apiserver-1  |     raise ValueError(errmsg % (host, INVALID_HOST_CHARS))

ValueError: Invalid host 'host1:27017,host2:27017,host3'. Host strings must have at least one non-period character, can't contain any of '!@#$%^&'"*()+=:;/', and can't have adjacent periods.

@smartnet-club smartnet-club reopened this Dec 11, 2024
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

4 participants