fix(slack): don't capture expected 401/403 scope errors from connected check#762
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(slack): don't capture expected 401/403 scope errors from connected check#762posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
…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
🧙 Wizard CIRun 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:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The wizard's Slack-connection check logged an expected 401/403 to error tracking as if it were a real crash.
fetchSlackConnectedGETs the project integrations endpoint to see whether Slack is already connected; when the access token doesn't carry theintegration:readscope, 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 calledanalytics.captureException, so an expected, handled condition showed up as a fresh error-tracking issue (noise, not a broken flow).Changes
isMissingScopeErrorin the api layer — a small axios predicate that recognizes a 401/403 from the integrations check as the benign "scope unavailable / not connected" outcome.captureExceptionfor those statuses while keeping the existing fallback (mark not connected, stop polling). Genuinely unexpected failures (network, 5xx, parse) are still captured.Test plan
isMissingScopeError(401/403 → true; 404/500, non-axios, non-error → false).pnpm build && pnpm test(1068 tests pass) andpnpm lint(no new warnings).Created with PostHog Code from an inbox report.