Skip to content

fix(slack): don't report handled auth failures on connect poll as exceptions#815

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/slack-connect-401-noise
Draft

fix(slack): don't report handled auth failures on connect poll as exceptions#815
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/slack-connect-401-noise

Conversation

@posthog

@posthog posthog Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Problem

The Slack connect screen's background poll reported a handled 401 auth failure to error tracking as a full exception, creating noise for the team.

fetchSlackConnected did a raw axios.get and threw the raw AxiosError. The SlackConnectScreen poll already handles this gracefully (marks the project not-connected, shows the connect nudge, stops polling), but it still called captureException for every failure — so an expected auth failure surfaced as a new error tracking issue. Nothing was broken for the user; the poll degrades cleanly. This is purely about error-tracking noise. The status we actually observed was a 401 (expired/invalid token), even though the missing-scope theory predicted a 403.

Changes

  • Route fetchSlackConnected through handleApiError, so it throws a clean ApiError with a statusCode — consistent with the other API helpers.
  • In the poll's catch handler, treat 401/403 as an expected degradation: record a benign wizardCapture analytics event instead of captureException. Any other error is still captured. The graceful nudge fallback is unchanged.
  • Correct the program-scopes.ts docstring, which predicted only a 403, to cover both the 401 and 403 auth paths.

Test plan

  • pnpm build && pnpm test && pnpm fix — all 1211 tests pass, lint clean.

Created with PostHog Code from an inbox report.

…eptions

The SlackConnectScreen background poll catches failures from
fetchSlackConnected gracefully — it marks the project not-connected, shows
the connect nudge, and stops polling — but it still called
captureException for every failure, so an expected auth failure (an
expired/invalid token 401, or a missing integration:read scope 403)
surfaced as a new error tracking issue.

Route fetchSlackConnected through handleApiError so it throws a clean
ApiError with a statusCode (consistent with the sibling API helpers), and
treat 401/403 on the poll as a benign analytics event rather than a
captured exception. The graceful nudge fallback is unchanged. Also
correct the program-scopes docstring, which predicted only a 403.

Generated-By: PostHog Code
Task-Id: d99c8488-726a-4e4d-8b3b-4c8e0dfb34fc
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci error-tracking-upload-source-maps
  • /wizard-ci mcp-analytics
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/cicd-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-nested-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-single-stage-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-gitlab-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-pnpm-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-raw-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-ssh-vps-node-raw
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants