Schema reconciliation failed: ** (Postgrex.Error) ERROR 42501 (insufficient_privilege) must be owner of table channels_invitations
Sentry Issue: ELECTRIC-4V1
-
[ ] This error should reach the user, should be clear what the action is and should not raise any exceptions in Sentry.
-
[ ] I'm curious how this escaped connection validation. Let's try to reproduce the error and check if there is a bug in the validation or the user changed the ownership afterwards
Schema reconciliation failed: ** (Postgrex.Error) ERROR 42501 (insufficient_privilege) must be owner of table XXXX
(electric 1.1.6) lib/electric/replication/publication_manager.ex:148: Electric.Replication.PublicationManager.refresh_publication/1
(electric 1.1.6) lib/electric/replication/schema_reconciler.ex:86: Electric.Replication.SchemaReconciler.handle_reconcile/1
(electric 1.1.6) lib/electric/replication/schema_reconciler.ex:60: Electric.Replication.SchemaReconciler.handle_continue/2
(stdlib 7.0.2) gen_server.erl:2424: :gen_server.try_handle_continue/3
(stdlib 7.0.2) gen_server.erl:2291: :gen_server.loop/4
(stdlib 7.0.2) proc_lib.erl:333: :proc_lib.init_p_do_apply/3
Seems related https://electricsql-04.sentry.io/issues/60710332/events/ada466a46dc64b3985615f0a7ac87892/
And this one too https://electricsql-04.sentry.io/issues/60712714/events/1ffa46ac5ec44cdf9ac10f7e3489eab0/
Yeah these are all symptoms of the same error. The error would reach the user in the case that it is in response to creating a new shape.
Unsure how wee want to handle this - this cannot be validated as we only validate we have the ability to create a publication, add tables, etc - but it might be that we do not have permission for a specific table or that the permission is modified after initial setup as you suggested.
Logging multiple errors for a single issue is a bit noisy however.
Tagging @alco as I think he was looking into this in https://github.com/electric-sql/electric/pull/2947
Funny how our info-level logs include the publication name but the errors do not and neither do they mention the source ID.