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.

fix(clerk): follow Clerk's rename of commerce endpoints to /billing (#78763)

Tom Owersf2581e08b742
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/settings.py
index 01782d9a20c4..a294fa988ff3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/settings.py
@@ -21,7 +21,7 @@ class ClerkEndpointConfig:
name: str
path: str
# `None` for endpoints whose objects carry no creation timestamp, so there is nothing stable
- # to partition on (Clerk's `/domains` and `/commerce/plans`).
+ # to partition on (Clerk's `/domains` and `/billing/plans`).
partition_key: Optional[str] = "created_at"
page_size: int = 100 # Clerk default, max is 500
# Some Clerk endpoints return {data: [...], total_count: ...}, others return direct arrays
@@ -101,14 +101,15 @@ CLERK_ENDPOINTS: dict[str, ClerkEndpointConfig] = {
"sms_templates": ClerkEndpointConfig(name="sms_templates", path="/templates/sms"),
"commerce_plans": ClerkEndpointConfig(
name="commerce_plans",
- path="/commerce/plans",
+ # Clerk renamed this from /commerce/plans to /billing/plans; the old path now answers 400.
+ path="/billing/plans",
partition_key=None,
is_wrapped_response=True,
gated_feature="Billing",
),
"commerce_subscription_items": ClerkEndpointConfig(
name="commerce_subscription_items",
- path="/commerce/subscription_items",
+ path="/billing/subscription_items",
is_wrapped_response=True,
gated_feature="Billing",
),
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/tests/test_clerk.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/tests/test_clerk.py
index bc2a6d7d8243..88e558182459 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/tests/test_clerk.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/tests/test_clerk.py
@@ -289,6 +289,18 @@ class TestClerkSourceResumeBehavior:
class TestClerkEndpoints:
+ @pytest.mark.parametrize(
+ ("endpoint", "path"),
+ [
+ # Clerk renamed these from /commerce/... to /billing/...; the old path now answers
+ # 400 Bad Request instead of serving the list.
+ ("commerce_plans", "/billing/plans"),
+ ("commerce_subscription_items", "/billing/subscription_items"),
+ ],
+ )
+ def test_commerce_endpoints_use_the_renamed_billing_path(self, endpoint: str, path: str) -> None:
+ assert CLERK_ENDPOINTS[endpoint].path == path
+
@pytest.mark.parametrize("endpoint", sorted(CLERK_ENDPOINTS))
def test_resource_targets_the_configured_path(self, endpoint: str) -> None:
config = CLERK_ENDPOINTS[endpoint]