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 URL: host is required for absolute urls #68

Closed
arcnmx opened this issue Mar 16, 2022 · 3 comments
Closed

Invalid URL: host is required for absolute urls #68

arcnmx opened this issue Mar 16, 2022 · 3 comments

Comments

@arcnmx
Copy link

arcnmx commented Mar 16, 2022

Attempting to use a config like:

appservice:
  database: postgres://mautrix-googlechat@/mautrix_googlechat

Now results in the following failure:

mautrix-googlechat[685955]:   File "/lib/python3.9/site-packages/mautrix/bridge/bridge.py", line 168, in prepare_db
mautrix-googlechat[685955]:     self.db = Database.create(
mautrix-googlechat[685955]:   File "/lib/python3.9/site-packages/mautrix/util/async_db/database.py", line 66, in create
mautrix-googlechat[685955]:     url = URL(url)
mautrix-googlechat[685955]:   File "/lib/python3.9/site-packages/yarl/_url.py", line 167, in __new__
mautrix-googlechat[685955]:     raise ValueError("Invalid URL: host is required for absolute urls")

Previously (on bafd1f7 with mautrix-python 0.14) this worked as expected. As far as I know, using an empty host is the only/standard way to indicate connection via local unix socket path rather than connecting over tcp, so I'm not sure what alternatives are meant to be used here?

This can be worked around by finding the actual socket path, and uri-encoding it into the host like postgres://mautrix-googlechat@%2Frun%2Fpostgresql/mautrix_googlechat

(this may actually be a mautrix-python issue, I'm not sure, should it be moved?)

@tulir
Copy link
Member

tulir commented Mar 16, 2022

Usually postgres:///mautrix_googlechat is enough. If you absolutely need a custom username, it might work with a ?user query parameter.

@arcnmx
Copy link
Author

arcnmx commented Mar 16, 2022

Fair, the username is only really there for consistency. The assumption by the error message seems false though? I didn't even try postgres:///x because the error message implies that it too would be invalid (given that it's absolute without a host). Maybe that also makes it a yarl issue, afaik a missing host can still be valid even with authority.

@Sodykhorn

This comment was marked as spam.

@tulir tulir closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants