mautrix / facebook

A Matrix-Facebook Messenger puppeting bridge
https://matrix.to/#/#facebook:maunium.net
GNU Affero General Public License v3.0
389 stars 64 forks source link

"ForeignTablesFound" error in log, can't load bridge #231

Closed HammyHavoc closed 2 years ago

HammyHavoc commented 2 years ago

Updated to the latest version of the bridge on the Docker repo, and now get this error when starting the container:

[2022-03-28 21:09:50,516] [CRITICAL@mau.init] Failed to initialize database Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/mautrix/bridge/bridge.py", line 191, in start_db await self.db.start() File "/usr/lib/python3.9/site-packages/mautrix/util/async_db/asyncpg.py", line 60, in start await super().start() File "/usr/lib/python3.9/site-packages/mautrix/util/async_db/database.py", line 101, in start await self._check_foreign_tables() File "/usr/lib/python3.9/site-packages/mautrix/util/async_db/database.py", line 109, in _check_foreign_tables raise ForeignTablesFound("found state_groups_state likely belonging to Synapse") mautrix.util.async_db.errors.ForeignTablesFound: The database contains foreign tables (found state_groups_state likely belonging to Synapse) [2022-03-28 21:09:50,519] [INFO@mau.init] You can use --ignore-foreign-tables to ignore this error

olmari commented 2 years ago

That is because too many peoples lately seems to point all sorts of bridges database to synapse or generally towards some other services database when bridges needs own databases. One database per one program...

HammyHavoc commented 2 years ago

I didn't realize this, don't think I saw it in the documentation either.

What's the best course of action? Is there a database cleanup process or list of tables etc to delete/move?

HammyHavoc commented 2 years ago

On https://docs.mau.fi/bridges/python/setup/docker.html?bridge=facebook, Update the config to your liking. You'll at least need to change the homeserver settings, appservice address, database address and bridge permissions. If you miss something that's required, the bridge will refuse to start and tell you what's missing. reads like setting it to the same database as the home server itself when mentioned following homeserver settings. It's also the only mention of the database on that page.

olmari commented 2 years ago

It does only tell you absolute minimum settings you need to touch in order to make bridge working, nowhere it says "use same database"... Homeserver settings you need to touch to define bridges registration.yaml to Synapse (or other homeserver program).

Also I don't think there exist cleanup stuff for this, because one shouldn't be doing this in the first place, and that's why check was implemented, I think...

HammyHavoc commented 2 years ago

Every other open source project I have ever encountered that makes use of plugins/extensions/bridges et al utilizes the same database, be it WordPress, Joomla, etc. So, perhaps this needs documenting better with a warning, because I'm absolutely not the first to do it if adding an in-log warning is necessary. I am however surprised that this wasn't addressed in the documentation before it was added to the logs.

sumnerevans commented 2 years ago

The bridge is an entirely different program to Synapse. It would be really bad if a bridge were able to access your Synapse database which is the source of truth for the entirety of your Matrix server. It should get its own database so that if it does something strange, it can't screw up your Matrix server.

HammyHavoc commented 2 years ago

Where do I go from here? Closed the Issue without resolving anything.

Will sponsor the repository if you can figure it out.

On Wed, 30 Mar 2022, 04:08 Sumner Evans, @.***> wrote:

Closed #231 https://github.com/mautrix/facebook/issues/231.

— Reply to this email directly, view it on GitHub https://github.com/mautrix/facebook/issues/231#event-6331450904, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD3BD6RTDZ5SDW7EFD22WTVCPARXANCNFSM5R4MKM5Q . You are receiving this because you authored the thread.Message ID: @.***>

olmari commented 2 years ago

You set up own database to bridge and not give it synapse one, nor any shared one in general...