Closed andrezimpel closed 9 months ago
Hey @andrezimpel. Can you share your Electric configuration and Postgres logs that correlate in time with the error? Redact any secret credentials from your config but please try to preserve the structure of individual options.
Postgres logs can be found in Supabase by clicking on the Logs button in the sidebar and selecting Postgres in the list on the left. Look for errors that were log at the same time when Electric logged its error.
Hitting the same error. Here's the relevant log metadata for me:
{
"file": null,
"host": "db-xxxxxxxxxxxxxxxxxxxx",
"metadata": [],
"parsed": [
{
"application_name": "Supavisor",
"backend_type": "client backend",
"command_tag": "idle",
"connection_from": "10.103.76.103:55522",
"context": null,
"database_name": "postgres",
"detail": null,
"error_severity": "ERROR",
"hint": null,
"internal_query": null,
"internal_query_pos": null,
"leader_pid": null,
"location": null,
"process_id": 139183,
"query": "CREATE_REPLICATION_SLOT \"electric_replication_out_postgres\" LOGICAL pgoutput NOEXPORT_SNAPSHOT",
"query_id": 0,
"query_pos": 1,
"session_id": "65b25f66.21faf",
"session_line_num": 4,
"session_start_time": "2024-01-25 13:17:26 UTC",
"sql_state_code": "42601",
"timestamp": "2024-01-25 13:17:27.146 UTC",
"transaction_id": 0,
"user_name": "postgres",
"virtual_transaction_id": "6/383037"
}
],
"parsed_from": null,
"project": null,
"source_type": null
}
Hey @andrezimpel and @marksteve. I have checked Supabase's database settings and noticed that it now defaults to showing a connection string for the connection pool whereas before it used to show a direct connection string first. Looks like Supabase's connection pool does not support replication connections.
Uncheck the "Use connection pooling" checkbox and copy the resulting URI into your DATABASE_URL
configuration.
In the meantime, I've opened https://github.com/electric-sql/electric/pull/896 to improve the error message.
Forgot to include the screenshot in my previous comment:
@alco true, thank you! it seems like supabase now disabled direct access with IPv4. Generating the client now fails for me. :/
$ electric-sql generate
Generating Electric client...
Service URL: http://workplace-sync-service.fly.dev
Proxy URL: postgresql://prisma:********@workplace-sync-service.fly.dev:65432/workplace
Error: Command failed: node xxx/build/index.js db pull --schema=".electric_migrations_tmp_i4bX42/prisma/schema.prisma"
Error: P1017
Server has closed the connection.
@andrezimpel Fly supports IPv6, so I"m not sure why it's failing for you. Are you running the latest version of Electric?
@alco my bad! The issue was that prisma could not introspect the database. That's why I encountered an error. Unfortunately I did not get the prisma error which would have given me a hint on the issue. It's working fine now!
Setting up a new service with Supabase as database on fly.io result sin the following error for me: MODULE ERROR: Electric.Replication.PostgresConnector
This only happens with Supabase.