Supabase with SSL #2840
-
Hi, it's my first time with postgres and since drift does support it I decided to use it with it since im familiar with drift. Can someone help me connect to a supabase database using ssl? I tried the following but I get LazyDatabase _openConnection() {
return LazyDatabase(() async {
final pgDatabase = PgDatabase(
endpoint: Endpoint(
host: 'db.yyyy.supabase.co',
port: 3333,
database: 'postgres',
username: 'postgres',
password: 'password',
),
settings: const PoolSettings(sslMode: SslMode.verifyFull),
);
return pgDatabase;
});
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I haven't used Supabase before, but if the server is using a self-signed certificate you can't use With isoos/postgresql-dart#280, you would be able to set a custom security context containing only the expected certificate. |
Beta Was this translation helpful? Give feedback.
-
@simolus3 could you also possibly help me understand this: the connection string is of this form: and supabase wants to make it of this form: is there a way to connect with connection pooling I am currently using this: final pgDatabase = PgDatabase(
endpoint: Endpoint(
host: 'db.my_db.supabase.co',
port: 5555,
database: 'postgres',
username: 'postgres',
password: 'pw',
),
settings: const PoolSettings(sslMode: SslMode.require),
); but there's nowhere to set |
Beta Was this translation helpful? Give feedback.
I haven't used Supabase before, but if the server is using a self-signed certificate you can't use
SslMode.verifyFull
by default. You could useSslMode.require
, which requires SSL but accepts every certificate. IMO that provides no real security at all and I tried lobbying for an API inpackage:postgres
that would allow only some self-signed certificates, but at the moment we only have these two options.With isoos/postgresql-dart#280, you would be able to set a custom security context containing only the expected certificate.