mautrix / twitter

A Matrix-Twitter DM puppeting bridge
GNU Affero General Public License v3.0
81 stars 19 forks source link

Initialization could not create propper postgres table? #9

Closed kamilr closed 3 years ago

kamilr commented 3 years ago

Synapse: 1.44 Mautrix/twitter: mautrix-twitter 0.1.2+dev.6bd5fb12

After adding appservice into homeserver.yaml every run give:

[2021-10-20 14:33:46,718] [INFO@mau.init] Initializing mautrix-twitter 0.1.2+dev.6bd5fb12
[2021-10-20 14:33:46,724] [INFO@mau.init] Initialization complete in 0.3 seconds
[2021-10-20 14:33:46,725] [DEBUG@mau.init] Running startup actions...
[2021-10-20 14:33:46,725] [DEBUG@mau.db] Connecting to postgres://<redacted>
[2021-10-20 14:33:47,395] [DEBUG@mau.db.upgrade] Database at v3, not upgrading
[2021-10-20 14:33:47,399] [DEBUG@mau.init] Starting appservice...
[2021-10-20 14:33:47,400] [DEBUG@mau.as] Starting appservice web server on 0.0.0.0:29327
[2021-10-20 14:33:47,401] [INFO@mau.mx] Ensuring connectivity to homeserver
[2021-10-20 14:33:47,422] [DEBUG@mau.bridge.e2ee] Logging in with bridge bot user
[2021-10-20 14:33:47,428] [DEBUG@mau.bridge.e2ee] Found device ID in database: <redacted>
[2021-10-20 14:33:47,443] [INFO@mau.bridge.e2ee] End-to-bridge encryption support is enabled
[2021-10-20 14:33:47,446] [DEBUG@mau.mx] Initializing appservice bot
[2021-10-20 14:33:47,449] [CRITICAL@mau.init] Unexpected error in main event loop
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mautrix/util/program.py", line 190, in _run
    self.loop.run_until_complete(self.start())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/lib/python3.9/site-packages/mautrix_twitter/__main__.py", line 76, in start
    await super().start()
  File "/usr/lib/python3.9/site-packages/mautrix/bridge/bridge.py", line 169, in start
    await super().start()
  File "/usr/lib/python3.9/site-packages/mautrix/util/program.py", line 213, in start
    await asyncio.gather(*(self.startup_actions or []))
  File "/usr/lib/python3.9/site-packages/mautrix/util/program.py", line 246, in _unpack_async_iterator
    async for task in iterable:
  File "/usr/lib/python3.9/site-packages/mautrix_twitter/user.py", line 91, in <genexpr>
    return (user.try_connect() async for user in cls.all_logged_in())
  File "/usr/lib/python3.9/site-packages/mautrix_twitter/user.py", line 415, in all_logged_in
    users = await super().all_logged_in()
  File "/usr/lib/python3.9/site-packages/mautrix_twitter/db/user.py", line 71, in all_logged_in
    rows = await cls.db.fetch(q)
  File "/usr/lib/python3.9/site-packages/mautrix/util/async_db/database.py", line 90, in fetch
    return await conn.fetch(query, *args, timeout=timeout)
  File "/usr/lib/python3.9/site-packages/asyncpg/connection.py", line 601, in fetch
    return await self._execute(
  File "/usr/lib/python3.9/site-packages/asyncpg/connection.py", line 1639, in _execute
    result, _ = await self.__execute(
  File "/usr/lib/python3.9/site-packages/asyncpg/connection.py", line 1664, in __execute
    return await self._do_execute(
  File "/usr/lib/python3.9/site-packages/asyncpg/connection.py", line 1691, in _do_execute
    stmt = await self._get_statement(
  File "/usr/lib/python3.9/site-packages/asyncpg/connection.py", line 393, in _get_statement
    statement = await self._protocol.prepare(
  File "asyncpg/protocol/protocol.pyx", line 168, in prepare
asyncpg.exceptions.UndefinedColumnError: column "twid" does not exist
HINT:  Perhaps you meant to reference the column "user.mxid" or the column "user.fbid".

Expected result: no error during reading database: no missing columns

@tulir Do You have idea how to fix it?

Regards

tulir commented 3 years ago

That looks like the database already contains something, make you provide an empty database.