Skip to content

fix(slack): don't capture expected 401/403 scope errors from connected check#762

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

fix(slack): don't capture expected 401/403 scope errors from connected check#762
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/slack-connect-scope-noise

Conversation

@posthog

@posthog posthog Bot commented Jun 29, 2026

Copy link
Copy Markdown

Problem

The wizard's Slack-connection check logged an expected 401/403 to error tracking as if it were a real crash. fetchSlackConnected GETs the project integrations endpoint to see whether Slack is already connected; when the access token doesn't carry the integration:read scope, that call 403s. The poll loop already handles this gracefully — it catches the error, marks Slack as not connected, falls back to the connect nudge, and stops polling — so it's exactly the documented degradation path. But the catch still called analytics.captureException, so an expected, handled condition showed up as a fresh error-tracking issue (noise, not a broken flow).

Changes

  • Add isMissingScopeError in the api layer — a small axios predicate that recognizes a 401/403 from the integrations check as the benign "scope unavailable / not connected" outcome.
  • In the Slack-connect poll's catch, skip captureException for those statuses while keeping the existing fallback (mark not connected, stop polling). Genuinely unexpected failures (network, 5xx, parse) are still captured.

Test plan

  • New unit tests for isMissingScopeError (401/403 → true; 404/500, non-axios, non-error → false).
  • pnpm build && pnpm test (1068 tests pass) and pnpm lint (no new warnings).

Created with PostHog Code from an inbox report.

…d check

The Slack-connection poll catches a failed `fetchSlackConnected` call,
falls back to the connect nudge, and stops polling. A 401/403 from that
endpoint is the documented degradation path — the access token lacks the
`integration:read` scope — but the catch still called
`analytics.captureException`, so an expected, handled condition surfaced
as an error-tracking issue.

Add `isMissingScopeError` in the api layer (axios 401/403 predicate) and
skip the capture for those statuses while keeping the existing nudge
fallback. Genuinely unexpected failures (network, 5xx, parse) are still
captured.

Generated-By: PostHog Code
Task-Id: cb810c10-91bd-4aac-aa37-6628591b3de0
@github-actions

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