Invalid IPv6 URL issue when connecting mysql
Describe the bug Invalid IPv6 URL issue when connecting MySQL
To Reproduce Steps to reproduce the behavior:
- on-board with MySQL database
- enter password contains
[or]
Expected behavior Should successfully connect.
Screenshots
Container Logs From ibis server
024-06-28 13:22:28 ValueError: Invalid IPv6 URL
2024-06-28 13:22:51 ERROR: Exception in ASGI application
2024-06-28 13:22:51 Traceback (most recent call last):
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
2024-06-28 13:22:51 result = await app( # type: ignore[func-returns-value]
2024-06-28 13:22:51 INFO: 192.168.0.6:38072 - "POST /v2/ibis/mysql/metadata/tables HTTP/1.1" 500 Internal Server Error
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
2024-06-28 13:22:51 return await self.app(scope, receive, send)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
2024-06-28 13:22:51 await super().__call__(scope, receive, send)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
2024-06-28 13:22:51 await self.middleware_stack(scope, receive, send)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
2024-06-28 13:22:51 raise exc
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
2024-06-28 13:22:51 await self.app(scope, receive, _send)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
2024-06-28 13:22:51 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-06-28 13:22:51 raise exc
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-06-28 13:22:51 await app(scope, receive, sender)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
2024-06-28 13:22:51 await self.middleware_stack(scope, receive, send)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
2024-06-28 13:22:51 await route.handle(scope, receive, send)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
2024-06-28 13:22:51 await self.app(scope, receive, send)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
2024-06-28 13:22:51 await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-06-28 13:22:51 raise exc
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-06-28 13:22:51 await app(scope, receive, sender)
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
2024-06-28 13:22:51 response = await func(request)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
2024-06-28 13:22:51 raw_response = await run_endpoint_function(
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
2024-06-28 13:22:51 return await run_in_threadpool(dependant.call, **values)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
2024-06-28 13:22:51 return await anyio.to_thread.run_sync(func, *args)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
2024-06-28 13:22:51 return await get_async_backend().run_sync_in_worker_thread(
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
2024-06-28 13:22:51 return await future
2024-06-28 13:22:51 ^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 859, in run
2024-06-28 13:22:51 result = context.run(func, *args)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/logger.py", line 19, in wrapper
2024-06-28 13:22:51 return f(*args, **kwargs)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/routers/v2/ibis.py", line 50, in get_table_list
2024-06-28 13:22:51 return metadata.get_table_list()
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/model/metadata/factory.py", line 32, in get_table_list
2024-06-28 13:22:51 return self.metadata.get_table_list()
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/model/metadata/mysql.py", line 35, in get_table_list
2024-06-28 13:22:51 DataSource.mysql.get_connection(self.connection_info)
2024-06-28 13:22:51 File "/app/model/data_source.py", line 37, in get_connection
2024-06-28 13:22:51 return DataSourceExtension[self].get_connection(info)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/model/data_source.py", line 60, in get_connection
2024-06-28 13:22:51 return getattr(self, f"get_{self.name}_connection")(info)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/model/data_source.py", line 92, in get_mysql_connection
2024-06-28 13:22:51 return ibis.connect(
2024-06-28 13:22:51 ^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/app/.venv/lib/python3.11/site-packages/ibis/backends/__init__.py", line 1364, in connect
2024-06-28 13:22:51 parsed = urllib.parse.urlparse(url)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/usr/local/lib/python3.11/urllib/parse.py", line 395, in urlparse
2024-06-28 13:22:51 splitresult = urlsplit(url, scheme, allow_fragments)
2024-06-28 13:22:51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-28 13:22:51 File "/usr/local/lib/python3.11/urllib/parse.py", line 497, in urlsplit
2024-06-28 13:22:51 raise ValueError("Invalid IPv6 URL")
2024-06-28 13:22:51 ValueError: Invalid IPv6 URL
Desktop (please complete the following information):
- OS: MacOSX
- Browser: chrome
Wren AI Information
- Version: 0.6.0
@wwwy3y3, this issue is fixed.
How was it fixed? Ansible is giving me the exact same error from urllib.
Using quote_plus
https://github.com/ibis-project/ibis/pull/9466/files#diff-cbaeeea4a81ef863cba8580da402897e356b1a8fdb6deb42418289a932a4d608R387
I still have the same issue but with postgres
Same error here.
Apparently only works with host.docker.internal
@finvernizzi-es fixed at https://github.com/Canner/WrenAI/pull/1281. Will release at next version.