Skip to content

Commit 15b2d8e

Browse files
authored
Disable SupabaseKeyCollector when a secret is configured (#148)
* Disable SupabaseKeyCollector when a specific secret is configured. * Add changeset.
1 parent 6432758 commit 15b2d8e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.changeset/plenty-poets-tan.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@powersync/service-module-postgres': patch
3+
'@powersync/service-image': patch
4+
---
5+
6+
Disable SupabaseKeyCollector when a specific secret is configured.

modules/module-postgres/src/module/PostgresModule.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@ export class PostgresModule extends replication.ReplicationModule<types.Postgres
2323
async initialize(context: system.ServiceContextContainer): Promise<void> {
2424
await super.initialize(context);
2525

26-
if (context.configuration.base_config.client_auth?.supabase) {
26+
const client_auth = context.configuration.base_config.client_auth;
27+
28+
if (client_auth?.supabase && client_auth?.supabase_jwt_secret == null) {
29+
// Only use the deprecated SupabaseKeyCollector when there is no
30+
// secret hardcoded. Hardcoded secrets are handled elsewhere, using
31+
// StaticSupabaseKeyCollector.
32+
33+
// Support for SupabaseKeyCollector is deprecated and support will be
34+
// completely removed by Supabase soon. We can keep support a while
35+
// longer for self-hosted setups, before also removing that on our side.
2736
this.registerSupabaseAuth(context);
2837
}
2938

0 commit comments

Comments
 (0)