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(stripe): point to try again after granting webhook write access (#106578)

Tom Owers70eec6669b16
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/stripe.py b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/stripe.py
index 1fc80d02bf8c..809851cb5338 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/stripe.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/stripe.py
@@ -1652,7 +1652,10 @@ def create_webhook(
)
return WebhookCreationResult(
success=False,
- error="Your Stripe API key doesn't have permission to create webhooks. Please add the 'Write' permission for 'Webhook endpoints' to your API key, or create the webhook manually.",
+ error=(
+ "Your Stripe API key can't create webhooks. Give it Write access on Webhook endpoints in "
+ "Stripe, then select Try again, or set up the webhook manually below."
+ ),
)
return WebhookCreationResult(success=False, error=f"Failed to create webhook automatically: {error_str}")
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py
index ff0cebfad417..053ce65e14af 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py
@@ -1682,7 +1682,7 @@ class TestCreateWebhookPermissionErrorCopy:
(
"api_key",
"forbidden",
- "add the 'Write' permission for 'Webhook endpoints' to your API key",
+ "Give it Write access on Webhook endpoints in Stripe, then select Try again",
None,
),
("oauth", "forbidden", "cannot create webhooks", "reconnect"),
diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/test_stripe_source.py b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/test_stripe_source.py
index 1380b6fb0588..cf73259dc6d7 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/test_stripe_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/stripe/test_stripe_source.py
@@ -1197,7 +1197,7 @@ class TestCreateWebhook:
assert result.success is False
assert result.error is not None
- assert "permission" in result.error.lower()
+ assert "Give it Write access on Webhook endpoints in Stripe, then select Try again" in result.error
def test_source_pins_the_resolved_version_on_the_endpoint(self):
endpoint = mock.MagicMock()