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(resend): surface a clear error when the OAuth account isn't connected (#73450)

Tom Owers0a79c10792f6
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/resend/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/resend/source.py
index 5bf70419dd6c..5b1cf65ffe94 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/resend/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/resend/source.py
@@ -183,7 +183,16 @@ Either way, the connection needs **full access** so the following resources can
try:
token = self._probe_token(config, team_id)
except ValueError as e:
- return False, str(e)
+ # _probe_token and the OAuth mixin raise deterministic config/credential errors
+ # (missing integration ID, integration deleted) whose developer wording is unhelpful in
+ # the wizard and can carry a volatile integration ID. Reuse the curated messages from
+ # get_non_retryable_errors so this path doesn't leak the internal string; fall back to
+ # the raw message if unmapped.
+ raw = str(e)
+ for pattern, friendly in self.get_non_retryable_errors().items():
+ if friendly and pattern in raw:
+ return False, friendly
+ return False, raw
if validate_resend_credentials(token):
return True, None
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/resend/tests/test_resend_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/resend/tests/test_resend_source.py
index f3d2bcf7c167..35d403de3a46 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/resend/tests/test_resend_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/resend/tests/test_resend_source.py
@@ -187,11 +187,22 @@ class TestResendSource:
assert error_message is not None and "reconnect" in error_message.lower()
@mock.patch.object(ResendSource, "get_oauth_integration", side_effect=ValueError("Integration not found: 42"))
- def test_validate_credentials_oauth_missing_integration(self, _mock_get_integration):
+ def test_validate_credentials_oauth_deleted_integration(self, _mock_get_integration):
is_valid, error_message = self.source.validate_credentials(_oauth_config(), self.team_id)
assert is_valid is False
- assert error_message == "Integration not found: 42"
+ # The raw "Integration not found: <id>" must be mapped to curated wording so the wizard
+ # never leaks the internal string or the volatile integration ID.
+ assert error_message == "The linked Resend integration no longer exists. Please reconnect your Resend account."
+ assert "42" not in (error_message or "")
+
+ def test_validate_credentials_oauth_missing_integration_id(self):
+ config = ResendSourceConfig(auth_method=ResendAuthMethodConfig(selection="oauth", resend_integration_id=None))
+
+ is_valid, error_message = self.source.validate_credentials(config, self.team_id)
+
+ assert is_valid is False
+ assert error_message == "Resend integration is not configured. Please reconnect your Resend account."
def test_get_resumable_source_manager(self):
inputs = mock.MagicMock()