Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-warehouse): enable CDC for Supabase sources (#64100)

Daniel RCc884aed51fe3
diff --git a/posthog/temporal/data_imports/cdc/activities.py b/posthog/temporal/data_imports/cdc/activities.py
index 07a87ffb37c0..88188e1d4100 100644
--- a/posthog/temporal/data_imports/cdc/activities.py
+++ b/posthog/temporal/data_imports/cdc/activities.py
@@ -24,7 +24,7 @@ from temporalio import activity
from posthog.settings import WAREHOUSE_SOURCES_DATABASE_URL
from posthog.temporal.common.activity_context import current_workflow_id, current_workflow_run_id
-from posthog.temporal.data_imports.cdc.adapters import get_cdc_adapter
+from posthog.temporal.data_imports.cdc.adapters import cdc_supported_source_types, get_cdc_adapter
from posthog.temporal.data_imports.cdc.batcher import (
ChangeEventBatcher,
build_scd2_table,
@@ -944,8 +944,6 @@ def cleanup_orphan_slots_activity() -> None:
"""
close_old_connections()
- from products.data_warehouse.backend.types import ExternalDataSourceType
-
log = logger.bind()
log.info("cleanup_orphan_slots_started")
@@ -955,7 +953,7 @@ def cleanup_orphan_slots_activity() -> None:
# point of this sweeper is to clean up slots for sources that were deleted.
cdc_sources = list(
ExternalDataSource.objects.filter(
- source_type=ExternalDataSourceType.POSTGRES,
+ source_type__in=cdc_supported_source_types(),
job_inputs__cdc_enabled=True,
)
.exclude(job_inputs__cdc_slot_name__isnull=True)
diff --git a/posthog/temporal/data_imports/cdc/adapters.py b/posthog/temporal/data_imports/cdc/adapters.py
index 0f7614eace89..c14093e9cf38 100644
--- a/posthog/temporal/data_imports/cdc/adapters.py
+++ b/posthog/temporal/data_imports/cdc/adapters.py
@@ -7,44 +7,28 @@ Each database engine needs its own adapter that knows how to:
- Clean up resources (drop slot, drop publication)
- Check replication lag
-Currently only Postgres is implemented. When adding MySQL or another engine,
-create an adapter in ``sources/<engine>/cdc/adapter.py`` and register it below.
+Postgres (and Supabase, which is Postgres on the wire) are implemented. When adding
+MySQL or another engine, create an adapter in ``sources/<engine>/cdc/adapter.py`` and
+register it in ``_cdc_adapters`` below.
"""
from __future__ import annotations
-import dataclasses
from collections.abc import Iterator
from contextlib import contextmanager
from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeVar
+from posthog.temporal.data_imports.cdc.types import CDCConfig
+from posthog.temporal.data_imports.sources.postgres.cdc.adapter import PostgresCDCAdapter
+
+from products.data_warehouse.backend.types import ExternalDataSourceType
+
if TYPE_CHECKING:
from posthog.temporal.data_imports.cdc.types import CDCStreamReader
from products.warehouse_sources.backend.models.external_data_source import ExternalDataSource
-ManagementMode = Literal["posthog", "self_managed"]
-
-
[email protected](frozen=True)
-class CDCConfig:
- """Base class for engine-specific CDC configs returned by ``parse_cdc_config``.
-
- Holds fields that apply to any change-stream engine (slot/publication-style
- identifiers, lag thresholds, management policy). Engine adapters return their
- own subclasses (e.g. ``PostgresCDCConfig``) and add engine-specific fields.
- """
-
- enabled: bool
- slot_name: str
- publication_name: str
- management_mode: ManagementMode
- lag_warning_threshold_mb: int
- lag_critical_threshold_mb: int
- auto_drop_slot: bool
-
-
CDCConfigT_co = TypeVar("CDCConfigT_co", bound=CDCConfig, covariant=True)
@@ -142,25 +126,44 @@ class CDCSourceAdapter(Protocol[CDCConfigT_co]):
...
+def _cdc_adapters() -> dict[ExternalDataSourceType, CDCSourceAdapter[CDCConfig]]:
+ """Registry of CDC adapters keyed by source type. Adding a new CDC-capable source
+ is a single entry here — everything else derives from this map."""
+ # Supabase is Postgres on the wire, so it reuses the Postgres adapter verbatim.
+ postgres_adapter = PostgresCDCAdapter()
+ return {
+ ExternalDataSourceType.POSTGRES: postgres_adapter,
+ ExternalDataSourceType.SUPABASE: postgres_adapter,
+ }
+
+
def get_cdc_adapter(source: ExternalDataSource) -> CDCSourceAdapter[CDCConfig]:
"""Return the CDC adapter for the given source's type.
Raises ValueError if the source type doesn't support CDC.
"""
- from posthog.temporal.data_imports.sources.postgres.cdc.adapter import PostgresCDCAdapter
-
- from products.data_warehouse.backend.types import ExternalDataSourceType
-
- adapters: dict[ExternalDataSourceType, CDCSourceAdapter[CDCConfig]] = {
- ExternalDataSourceType.POSTGRES: PostgresCDCAdapter(),
- }
-
try:
source_type = ExternalDataSourceType(source.source_type)
except ValueError as e:
raise ValueError(f"CDC is not supported for source type: {source.source_type}") from e
- adapter = adapters.get(source_type)
+ adapter = _cdc_adapters().get(source_type)
if adapter is None:
raise ValueError(f"CDC is not supported for source type: {source.source_type}")
return adapter
+
+
+def cdc_supported_source_types() -> list[ExternalDataSourceType]:
+ """Source types that support CDC. Use for queries (e.g. ``source_type__in=...``)."""
+ return list(_cdc_adapters().keys())
+
+
+def source_type_supports_cdc(source_type: ExternalDataSourceType | str | None) -> bool:
+ """Whether the given source type (enum or raw string) supports CDC."""
+ if source_type is None:
+ return False
+ try:
+ resolved = ExternalDataSourceType(source_type)
+ except ValueError:
+ return False
+ return resolved in _cdc_adapters()
diff --git a/posthog/temporal/data_imports/cdc/types.py b/posthog/temporal/data_imports/cdc/types.py
index 43187e6420d9..d52aca967441 100644
--- a/posthog/temporal/data_imports/cdc/types.py
+++ b/posthog/temporal/data_imports/cdc/types.py
@@ -5,6 +5,26 @@ from dataclasses import dataclass
from datetime import datetime
from typing import Any, Literal, Protocol, Self
+ManagementMode = Literal["posthog", "self_managed"]
+
+
+@dataclass(frozen=True)
+class CDCConfig:
+ """Base class for engine-specific CDC configs returned by ``parse_cdc_config``.
+
+ Holds fields that apply to any change-stream engine (slot/publication-style
+ identifiers, lag thresholds, management policy). Engine adapters return their
+ own subclasses (e.g. ``PostgresCDCConfig``) and add engine-specific fields.
+ """
+
+ enabled: bool
+ slot_name: str
+ publication_name: str
+ management_mode: ManagementMode
+ lag_warning_threshold_mb: int
+ lag_critical_threshold_mb: int
+ auto_drop_slot: bool
+
class CDCPosition(Protocol):
"""Opaque replication position. PG=LSN, MySQL=GTID set."""
diff --git a/posthog/temporal/data_imports/sources/postgres/cdc/config.py b/posthog/temporal/data_imports/sources/postgres/cdc/config.py
index e542406b0add..7b100e4f4223 100644
--- a/posthog/temporal/data_imports/sources/postgres/cdc/config.py
+++ b/posthog/temporal/data_imports/sources/postgres/cdc/config.py
@@ -11,7 +11,7 @@ from __future__ import annotations
import dataclasses
from typing import TYPE_CHECKING
-from posthog.temporal.data_imports.cdc.adapters import CDCConfig, ManagementMode
+from posthog.temporal.data_imports.cdc.types import CDCConfig, ManagementMode
if TYPE_CHECKING:
from products.warehouse_sources.backend.models.external_data_source import ExternalDataSource
diff --git a/posthog/temporal/data_imports/sources/supabase/source.py b/posthog/temporal/data_imports/sources/supabase/source.py
index 93fd455059b1..07d60d5b3cb9 100644
--- a/posthog/temporal/data_imports/sources/supabase/source.py
+++ b/posthog/temporal/data_imports/sources/supabase/source.py
@@ -35,10 +35,18 @@ _SourceField = (
_SUPABASE_DIRECT_HOST_RE = re.compile(r"^db\.[a-z0-9]+\.supabase\.co$", re.IGNORECASE)
_SUPABASE_POOLER_HOST_CAPTION = (
- "Use the **Session pooler** host from Supabase (Project settings → Database → "
+ "For standard syncs, use the **Session pooler** host (Project settings → Database → "
"Connection pooling), e.g. `aws-0-<region>.pooler.supabase.com`, with username "
- "`postgres.<project-ref>`. The direct host `db.<ref>.supabase.co` is IPv6-only and "
- "won't be reachable."
+ "`postgres.<project-ref>` — the direct host `db.<ref>.supabase.co` is IPv6-only. "
+ "For **change data capture (CDC)** you must use the direct host instead and enable "
+ "Supabase's **IPv4 add-on**, because logical replication doesn't work through the pooler."
+)
+
+_SUPABASE_DIRECT_HOST_IPV4_HINT = (
+ "Couldn't reach the Supabase direct host (db.<ref>.supabase.co). It's IPv6-only unless you "
+ "enable Supabase's IPv4 add-on (Project settings → Add-ons), which is required for change "
+ "data capture. For standard (non-CDC) syncs, use the Session pooler host instead "
+ "(aws-0-<region>.pooler.supabase.com) with username postgres.<project-ref>."
)
@@ -53,8 +61,6 @@ class SupabaseSource(PostgresSource):
@staticmethod
def _adjust_field(field: _SourceField) -> _SourceField:
- if isinstance(field, SourceFieldInputConfig) and field.name == "schema":
- return field.model_copy(update={"required": True, "label": "Schema", "caption": None})
if isinstance(field, SourceFieldInputConfig) and field.name == "host":
return field.model_copy(
update={
@@ -81,13 +87,12 @@ class SupabaseSource(PostgresSource):
def validate_credentials(
self, config: PostgresSourceConfig, team_id: int, schema_name: Optional[str] = None
) -> tuple[bool, str | None]:
- # Catch the IPv6-only direct host before the generic Postgres connect attempt
- # times out with an opaque "could not connect to the host on the port given".
- if _SUPABASE_DIRECT_HOST_RE.match((config.host or "").strip()):
- return False, (
- "This looks like the Supabase direct database host (db.<ref>.supabase.co), which is "
- "IPv6-only and unreachable from PostHog. Use the Session pooler host instead "
- "(aws-0-<region>.pooler.supabase.com) with username postgres.<project-ref> — find it "
- "under Project settings → Database → Connection pooling."
- )
- return super().validate_credentials(config, team_id, schema_name=schema_name)
+ # The direct host (IPv6-only by default) is the only host that supports logical
+ # replication, so CDC users need it. We let the real connection attempt decide
+ # reachability — it succeeds when the IPv4 add-on is enabled — and only swap in a
+ # clearer message when it fails, since the generic Postgres error is opaque.
+ is_direct_host = bool(_SUPABASE_DIRECT_HOST_RE.match((config.host or "").strip()))
+ success, error = super().validate_credentials(config, team_id, schema_name=schema_name)
+ if not success and is_direct_host:
+ return False, _SUPABASE_DIRECT_HOST_IPV4_HINT
+ return success, error
diff --git a/posthog/temporal/data_imports/sources/supabase/test_supabase_source.py b/posthog/temporal/data_imports/sources/supabase/test_supabase_source.py
index 9ec6c3c4e77d..225170112f71 100644
--- a/posthog/temporal/data_imports/sources/supabase/test_supabase_source.py
+++ b/posthog/temporal/data_imports/sources/supabase/test_supabase_source.py
@@ -15,12 +15,12 @@ def _field(name: str) -> SourceFieldInputConfig:
)
-def test_supabase_requires_schema_field():
+def test_supabase_schema_field_is_optional():
+ # Multi-schema is supported (same as Postgres), so the schema field must not be required.
schema_field = _field("schema")
- assert schema_field.required is True
+ assert schema_field.required is False
assert schema_field.label == "Schema"
- assert schema_field.caption is None
def test_supabase_is_generally_available():
@@ -47,28 +47,28 @@ def test_supabase_host_field_points_at_the_pooler():
" db.abcdefgh.supabase.co ",
],
)
-def test_direct_host_is_rejected_with_pooler_guidance(host):
+def test_direct_host_failure_surfaces_ipv4_addon_hint(host):
+ # The direct host is the only one that supports logical replication (CDC), so we let the
+ # connection attempt run; on failure we explain the IPv4 add-on requirement.
config = mock.MagicMock(host=host)
- with mock.patch.object(PostgresSource, "validate_credentials") as super_validate:
+ with mock.patch.object(PostgresSource, "validate_credentials", return_value=(False, "could not connect")):
success, error = SupabaseSource().validate_credentials(config, team_id=1)
assert success is False
assert error is not None
- assert "pooler" in error.lower()
- # We short-circuit before attempting the generic Postgres connection.
- super_validate.assert_not_called()
+ assert "ipv4 add-on" in error.lower()
@pytest.mark.parametrize(
"host",
[
+ "db.abcdefghijklmnop.supabase.co",
"aws-0-us-east-1.pooler.supabase.com",
"db.example.com",
- "my-db.internal",
],
)
-def test_pooler_and_other_hosts_delegate_to_postgres(host):
+def test_successful_connection_delegates_to_postgres(host):
config = mock.MagicMock(host=host)
with mock.patch.object(PostgresSource, "validate_credentials", return_value=(True, None)) as super_validate:
@@ -77,3 +77,20 @@ def test_pooler_and_other_hosts_delegate_to_postgres(host):
assert success is True
assert error is None
super_validate.assert_called_once()
+
+
+ "host",
+ [
+ "aws-0-us-east-1.pooler.supabase.com",
+ "my-db.internal",
+ ],
+)
+def test_non_direct_host_failure_uses_postgres_error(host):
+ config = mock.MagicMock(host=host)
+
+ with mock.patch.object(PostgresSource, "validate_credentials", return_value=(False, "postgres error")):
+ success, error = SupabaseSource().validate_credentials(config, team_id=1)
+
+ assert success is False
+ assert error == "postgres error"
diff --git a/products/data_warehouse/backend/api/external_data_schema.py b/products/data_warehouse/backend/api/external_data_schema.py
index 8d1a5bfc0da5..1e9e3acead26 100644
--- a/products/data_warehouse/backend/api/external_data_schema.py
+++ b/products/data_warehouse/backend/api/external_data_schema.py
@@ -15,7 +15,7 @@ from posthog.hogql.database.database import Database
from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.api.utils import action
from posthog.exceptions_capture import capture_exception
-from posthog.temporal.data_imports.cdc.adapters import get_cdc_adapter
+from posthog.temporal.data_imports.cdc.adapters import get_cdc_adapter, source_type_supports_cdc
from posthog.temporal.data_imports.sources import SourceRegistry
from posthog.temporal.data_imports.sources.common.base import WebhookSource
from posthog.temporal.data_imports.sources.common.sql import (
@@ -708,7 +708,7 @@ class ExternalDataSchemaSerializer(serializers.ModelSerializer):
is_cdc = (sync_type == ExternalDataSchema.SyncType.CDC) or (
sync_type is None and instance.sync_type == ExternalDataSchema.SyncType.CDC
)
- if is_cdc and source.source_type == ExternalDataSourceType.POSTGRES:
+ if is_cdc and source_type_supports_cdc(source.source_type):
self._handle_cdc_publication_change(instance, source, should_sync, sync_type)
if trigger_refresh:
diff --git a/products/data_warehouse/backend/api/external_data_source.py b/products/data_warehouse/backend/api/external_data_source.py
index 2b60ffb73094..3a9dae3af3f0 100644
--- a/products/data_warehouse/backend/api/external_data_source.py
+++ b/products/data_warehouse/backend/api/external_data_source.py
@@ -42,7 +42,7 @@ from posthog.exceptions_capture import capture_exception
from posthog.models.user import User
from posthog.rbac.access_control_api_mixin import AccessControlViewSetMixin
from posthog.rbac.user_access_control import UserAccessControlSerializerMixin
-from posthog.temporal.data_imports.cdc.adapters import CDCSourceAdapter, get_cdc_adapter
+from posthog.temporal.data_imports.cdc.adapters import CDCSourceAdapter, get_cdc_adapter, source_type_supports_cdc
from posthog.temporal.data_imports.sources import SourceRegistry
from posthog.temporal.data_imports.sources.common.base import AnySource, ExternalWebhookInfo, FieldType, WebhookSource
from posthog.temporal.data_imports.sources.common.config import Config
@@ -2535,10 +2535,10 @@ class ExternalDataSourceViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixi
and by the self-managed setup popup to verify user-created publications.
"""
source_type = request.data.get("source_type")
- if source_type != ExternalDataSourceType.POSTGRES:
+ if not source_type_supports_cdc(source_type):
return Response(
status=status.HTTP_400_BAD_REQUEST,
- data={"message": "CDC prerequisite checks are only supported for Postgres."},
+ data={"message": "CDC prerequisite checks are only supported for CDC enabled sources."},
)
source_impl: PostgresSource = PostgresSource()
diff --git a/products/data_warehouse/backend/api/test/test_external_data_source.py b/products/data_warehouse/backend/api/test/test_external_data_source.py
index dfa8b1b80b58..ea209ef4719e 100644
--- a/products/data_warehouse/backend/api/test/test_external_data_source.py
+++ b/products/data_warehouse/backend/api/test/test_external_data_source.py
@@ -7774,6 +7774,7 @@ def _make_postgres_source(
slot_name: str = "posthog_slot",
pub_name: str = "posthog_pub",
extra_job_inputs: dict | None = None,
+ source_type: str = "Postgres",
) -> ExternalDataSource:
job_inputs: dict[str, t.Any] = {
"host": "localhost",
@@ -7803,7 +7804,7 @@ def _make_postgres_source(
source_id=str(uuid.uuid4()),
connection_id=str(uuid.uuid4()),
destination_id=str(uuid.uuid4()),
- source_type="Postgres",
+ source_type=source_type,
created_by=user,
prefix="pg_",
job_inputs=job_inputs,
@@ -7953,6 +7954,20 @@ class TestCheckCDCPrerequisitesWizard(APIBaseTest):
# User/upstream connection failures must not pollute error tracking.
mock_capture.assert_not_called()
+ @patch.object(PostgresSource, "is_database_host_valid", return_value=(True, None))
+ @patch.object(PostgresSource, "ssh_tunnel_is_valid", return_value=(True, None))
+ @patch.object(PostgresSource, "check_cdc_prerequisites", return_value=[])
+ def test_supabase_source_type_is_accepted(self, _mock_prereqs, _mock_ssh, _mock_host) -> None:
+ # Supabase is Postgres on the wire — the prereq endpoint must not reject it by source type.
+ response = self._post(source_type="Supabase")
+ assert response.status_code == 200, response.content
+ assert response.json() == {"valid": True, "errors": []}
+
+ def test_unsupported_source_type_is_rejected(self) -> None:
+ response = self._post(source_type="Stripe")
+ assert response.status_code == 400
+ assert "only supported for" in response.json()["message"]
+
@patch("products.data_warehouse.backend.api.external_data_source.capture_exception")
@patch.object(PostgresSource, "is_database_host_valid", return_value=(True, None))
@patch.object(PostgresSource, "ssh_tunnel_is_valid", return_value=(True, None))
@@ -8124,6 +8139,34 @@ class TestEnableCDC(APIBaseTest):
mock_sync_extraction.assert_called_once()
mock_ensure_cleanup.assert_called_once()
+ @patch("products.data_warehouse.backend.api.external_data_source.is_cdc_enabled_for_team", return_value=True)
+ @patch(
+ "posthog.temporal.data_imports.sources.postgres.cdc.adapter.PostgresCDCAdapter.validate_prerequisites",
+ return_value=[],
+ )
+ @patch("products.data_warehouse.backend.api.external_data_source.ExternalDataSourceViewSet._setup_cdc_resources")
+ @patch("products.data_warehouse.backend.api.external_data_source.sync_cdc_extraction_schedule")
+ @patch("products.data_warehouse.backend.api.external_data_source.ensure_cdc_slot_cleanup_schedule")
+ def test_enable_cdc_succeeds_for_supabase(
+ self,
+ _mock_ensure_cleanup,
+ _mock_sync_extraction,
+ mock_setup_cdc_resources,
+ _check,
+ _flag,
+ ) -> None:
+ # Supabase reuses the Postgres CDC adapter, so the source-type gate must let it through.
+ source = _make_postgres_source(self.team.pk, self.user, source_type="Supabase")
+ mock_setup_cdc_resources.return_value = None
+
+ response = self.client.post(
+ f"/api/environments/{self.team.pk}/external_data_sources/{source.pk}/enable_cdc/",
+ data={"cdc_management_mode": "posthog"},
+ format="json",
+ )
+
+ assert response.status_code == 200, response.content
+
@patch("products.data_warehouse.backend.api.external_data_source.is_cdc_enabled_for_team", return_value=True)
@patch(
"posthog.temporal.data_imports.sources.postgres.cdc.adapter.PostgresCDCAdapter.validate_prerequisites",
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
index 7b048b22a1ee..b89d1be05423 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
@@ -636,7 +636,7 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
try {
return await api.externalDataSources.check_cdc_prerequisites(
{
- source_type: 'Postgres' as ExternalDataSourceType,
+ source_type: (values.selectedConnector?.name || 'Postgres') as ExternalDataSourceType,
...payload,
cdc_management_mode: mode,
tables: [],
@@ -673,7 +673,7 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
try {
return await api.externalDataSources.check_cdc_prerequisites(
{
- source_type: 'Postgres' as ExternalDataSourceType,
+ source_type: (values.selectedConnector?.name || 'Postgres') as ExternalDataSourceType,
...connectionPayload,
cdc_management_mode: 'self_managed',
// PostHog creates the slot itself — only verify the publication.
diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/CDCSection.tsx b/products/data_warehouse/frontend/scenes/SourceScene/tabs/CDCSection.tsx
index 6fb91a1c135c..561745dcca08 100644
--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/CDCSection.tsx
+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/CDCSection.tsx
@@ -27,6 +27,7 @@ import { humanizeBytes } from 'lib/utils/numbers'
import { AccessControlLevel, AccessControlResourceType, ExternalDataSource } from '~/types'
+import { CDC_SOURCE_TYPES } from '../../../shared/cdc'
import { sourceSettingsLogic } from './sourceSettingsLogic'
type ManagementMode = 'posthog' | 'self_managed'
@@ -146,7 +147,7 @@ function confirmThen(opts: {
export function CDCSection({ source }: { source: ExternalDataSource }): JSX.Element | null {
const { featureFlags } = useValues(featureFlagLogic)
- if (source.source_type !== 'Postgres') {
+ if (!CDC_SOURCE_TYPES.includes(source.source_type)) {
return null
}
if (source.access_method !== 'warehouse') {
diff --git a/products/data_warehouse/frontend/shared/cdc.ts b/products/data_warehouse/frontend/shared/cdc.ts
new file mode 100644
index 000000000000..f167fe948249
--- /dev/null
+++ b/products/data_warehouse/frontend/shared/cdc.ts
@@ -0,0 +1,4 @@
+// Source types that support change data capture (logical replication). Supabase is
+// Postgres on the wire and reuses the same CDC path. Keep in sync with the backend
+// adapter registry in posthog/temporal/data_imports/cdc/adapters.py.
+export const CDC_SOURCE_TYPES: string[] = ['Postgres', 'Supabase']
diff --git a/products/data_warehouse/frontend/shared/components/forms/SourceForm.tsx b/products/data_warehouse/frontend/shared/components/forms/SourceForm.tsx
index 5210860de44c..4728a680a93c 100644
--- a/products/data_warehouse/frontend/shared/components/forms/SourceForm.tsx
+++ b/products/data_warehouse/frontend/shared/components/forms/SourceForm.tsx
@@ -31,6 +31,7 @@ import {
type SourceWizardLogicProps,
sourceWizardLogic,
} from '../../../scenes/NewSourceScene/sourceWizardLogic'
+import { CDC_SOURCE_TYPES } from '../../cdc'
import { CustomSourceManifestBuilder } from './CustomSourceManifestBuilder'
import { GitHubRepositorySelector } from './GitHubRepositorySelector'
import { SourceIntegrationChoice } from './IntegrationChoice'
@@ -452,13 +453,24 @@ function CDCPrerequisitesCheck(): JSX.Element {
)
}
-function CDCConfigSection(): JSX.Element {
+function CDCConfigSection({ sourceName }: { sourceName: string }): JSX.Element {
// showAdvanced is purely local UI toggle — not a form field
const [showAdvanced, setShowAdvanced] = React.useState(false)
return (
<Group name="payload">
<div className="space-y-4 mt-4">
+ {sourceName === 'Supabase' && (
+ <LemonBanner type="warning">
+ <p className="font-semibold mb-1">Supabase CDC needs the direct connection + IPv4 add-on</p>
+ <p className="text-xs m-0">
+ Logical replication doesn't work through the Supabase pooler. Use the{' '}
+ <strong>direct host</strong> (<code>db.&lt;ref&gt;.supabase.co</code>) and enable Supabase's{' '}
+ <strong>IPv4 add-on</strong> (Project settings → Add-ons) so PostHog can reach it. The
+ pooler host is fine for standard syncs but won't work for CDC.
+ </p>
+ </LemonBanner>
+ )}
<LemonField name="cdc_enabled">
{({ value: cdcEnabled, onChange }) => (
<div
@@ -810,9 +822,9 @@ export function SourceFormComponent({
</Group>
{!isUpdateMode &&
showCdcConfig &&
- sourceConfig.name === 'Postgres' &&
+ CDC_SOURCE_TYPES.includes(sourceConfig.name) &&
featureFlags[FEATURE_FLAGS.DWH_POSTGRES_CDC] &&
- selectedAccessMethod === 'warehouse' && <CDCConfigSection />}
+ selectedAccessMethod === 'warehouse' && <CDCConfigSection sourceName={sourceConfig.name} />}
{showPrefix && !isDirectQuerySource && (
<LemonField
name="prefix"