electric-sql / electric

Local-first sync layer for web and mobile apps. Build reactive, realtime, local-first apps directly on Postgres.
https://electric-sql.com
Apache License 2.0
5.47k stars 125 forks source link

Initialization Error Using Supabase #1421

Open e-lobo opened 1 week ago

e-lobo commented 1 week ago
 Failed to start child Electric.Replication.PostgresConnectorMng:
▓   {{:case_clause, :undefined}, [{Electric.Replication.PostgresConnectorMng, :get_verify_peer_opts, 0, [file: ~c"lib/electric/replication/postgres_manager.ex", line: 358]}, {Electric.Replication.PostgresConnectorMng, :maybe_verify_peer, 1, [file: ~c"lib/electric/replication/postgres_manager.ex", line: 350]}, {Keyword, :update!, 4, [file: ~c"lib/keyword.ex", line: 1144]}, {Keyword, :update!, 4, [file: ~c"lib/keyword.ex", line: 1148]}, {Electric.Replication.PostgresConnectorMng, :update_connector_config, 2, [file: ~c"lib/electric/replication/postgres_manager.ex", line: 119]}, {Electric.Replication.PostgresConnectorMng, :init, 1, [file: ~c"lib/electric/replication/postgres_manager.ex", line: 94]}, {:gen_server, :init_it, 2, [file: ~c"gen_server.erl", line: 2057]}, {:gen_server, :init_it, 6, [file: ~c"gen_server.erl", line: 2012]}]}

getting the above when trying to launch the sync service locally using docker + supabase cloud instance

linear[bot] commented 1 week ago

VAX-2004 INITIALISATION ERROR

e-lobo commented 1 week ago

I have tried with electricsql/electric:latest which throws the above mentioned above. I have tried with electricsql/electric:canary which also errors out but changing the connection string to use supabase's connection pooling session it does progress a bit but ends in an error as well

INFO REPORT==== 4-Jul-2024::11:51:37.527669 ===
Loading 140 CA(s) from otp store
11:51:37.630 pid=<0.3297.0> [info] Starting ElectricSQL 0.12.1-25-g392a36b in direct_writes mode.
11:51:37.636 pid=<0.3298.0> [info] Running Electric.Plug.Router with Bandit 1.5.3 at :::5133 (http)
11:51:37.701 pid=<0.3612.0> origin=postgres_1 [info] Postgres.Client.with_conn(%{timeout: 5000, port: 5432, ssl: :required, host: ~c"aws-0-ap-south-1.pooler.supabase.com", ipv6: true, password: ~c"******", username: ~c"postgres.gdxrfufmosalwdfigxdw", database: ~c"postgres", ssl_opts: [server_name_indication: ~c"aws-0-ap-south-1.pooler.supabase.com", verify: :verify_none], nulls: [nil, :null, :undefined], ip_addr: ~c"3.108.251.216"})
11:51:38.270 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230328113927
11:51:38.546 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230424154425
11:51:42.046 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230512000000
11:51:42.291 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230605141256
11:51:42.611 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230715000000
11:51:42.878 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230814170123
11:51:50.262 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230814170745
11:51:50.567 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230829000000
11:51:50.785 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230918115714
11:51:50.857 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230921161045
11:51:51.033 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20230921161418
11:51:51.621 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20231009121515
11:51:51.775 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20231010123118
11:51:51.915 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20231016141000
11:51:52.059 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20231206130400
11:51:52.431 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20240110110200
11:51:52.582 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20240205141200
11:51:52.801 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20240213160300
11:51:52.869 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20240417131000
11:51:53.112 pid=<0.3612.0> origin=postgres_1 [info] Running extension migration: 20240501000000
11:51:54.849 pid=<0.3612.0> origin=postgres_1 [info] Successfully initialized origin postgres_1 at extension version 20240501000000
11:51:54.850 pid=<0.3627.0> [info] Starting Proxy server listening on port 65432
11:51:55.788 pid=<0.3694.0> pg_producer=postgres_1 [info] Starting Elixir.Electric.Postgres.Extension.SchemaCache for postgres_1
11:51:55.789 pid=<0.3694.0> pg_producer=postgres_1 [warning] SchemaCache "postgres_1" registered as the global instance
11:51:55.790 pid=<0.3697.0> pg_producer=postgres_1 [info] Starting replication with publication=electric_publication and slots=electric_replication_out_postgres,electric_replication_out_postgres_rc}
11:51:56.098 pid=<0.3612.0> origin=postgres_1 [error] PostgresConnectorSup failed to start child Electric.Replication.Postgres.LogicalReplicationProducer with reason: {:bad_return_value, {:error, {:create_replication_slot_syntax_error, "syntax error at or near \"CREATE_REPLICATION_SLOT\""}}}.
▓ ┌───────────────────────┐
▓ │  CONFIGURATION ERROR  │
▓ ┕━━━━━━━━━━━━━━━━━━━━━━━┙
▓ 
▓ Failed to establish replication connection to Postgres:
▓   syntax error at or near "CREATE_REPLICATION_SLOT"
▓ 
▓ Make sure the value of DATABASE_URL is a connection string that can be used
▓ to connect to your database directly, not through a connection pool.
brandonkboswell commented 1 week ago

I am also experiencing this when trying to run a local instance of electric with cloud hosted supabase.

brandonkboswell commented 3 days ago

@e-lobo FYI I was able to successfully connect when not using a local Docker instance. In my case by using Fly.io with the canary build.