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.

chore(hog-functions): send users to settings when slack oauth missing (#59987)

Rafael Audibert27db80391608
diff --git a/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx b/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
index d41ade0c10fc..793693697ec4 100644
--- a/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
+++ b/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
@@ -32,7 +32,7 @@ export function IntegrationChoice({
redirectUrl,
beforeRedirect,
}: IntegrationConfigureProps): JSX.Element | null {
- const { integrationsLoading, integrations, newIntegrationModalKind } = useValues(integrationsLogic)
+ const { integrationsLoading, integrations, newIntegrationModalKind, slackAvailable } = useValues(integrationsLogic)
const { newGoogleCloudKey, openNewIntegrationModal, closeNewIntegrationModal, deleteIntegration } =
useActions(integrationsLogic)
const kind = integration
@@ -90,16 +90,25 @@ export function IntegrationChoice({
const isSandbox = new URLSearchParams(window.location.search).get('is_sandbox') === 'true'
const setupDef = getIntegrationSetup(kind)
+ // When the instance doesn't have OAuth credentials for this kind, /integrations/authorize
+ // 400s with "Kind not configured". Send users to the settings page instead.
+ const oauthUnavailable = kind === 'slack' && !slackAvailable
const setupMenuItem = setupDef
? setupDef.menuItem({ kind, openModal: openNewIntegrationModal, uploadKey })
- : {
- to: api.integrations.authorizeUrl({ kind, next: redirectUrl, is_sandbox: isSandbox || undefined }),
- disableClientSideRouting: true,
- onClick: beforeRedirect,
- label: integrationsOfKind?.length
- ? `Connect to a different integration for ${kindName}`
- : `Connect to ${kindName}`,
- }
+ : oauthUnavailable
+ ? {
+ to: urls.settings('project-integrations'),
+ sideIcon: <IconExternal />,
+ label: `${kindName} is not configured on this instance`,
+ }
+ : {
+ to: api.integrations.authorizeUrl({ kind, next: redirectUrl, is_sandbox: isSandbox || undefined }),
+ disableClientSideRouting: true,
+ onClick: beforeRedirect,
+ label: integrationsOfKind?.length
+ ? `Connect to a different integration for ${kindName}`
+ : `Connect to ${kindName}`,
+ }
const button = (
<LemonMenu