fix: don't report expected 401/403 from Slack-connected poll as exceptions#784
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix: don't report expected 401/403 from Slack-connected poll as exceptions#784posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
…tions The SlackConnectScreen poll calls fetchSlackConnected, which throws on any non-2xx. The catch degrades gracefully (stops polling, falls back to the connect nudge) but then reports every failure via captureException. A plain token-expiry 401 (or a missing-scope 403) is expected here and non-actionable, yet it surfaces as a real exception in error tracking. Add httpStatusOf() to api.ts and branch on it in the poll's catch: a 401/403 is downgraded to a debug log plus a lightweight "slack connect check skipped" breadcrumb event, while anything else is still captured as an exception. Generated-By: PostHog Code Task-Id: b146df1d-03fd-41f1-80bb-229fd5525490
🧙 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 Slack-connected poll on
SlackConnectScreenwas reporting expected auth failures to error tracking as if they were real exceptions.fetchSlackConnected(src/lib/api.ts) does anaxios.getwith no try/catch, so it throws on any non-2xx. The poll's.catchdegrades gracefully — it stops polling and falls back to the connect nudge — but then reports the error viaanalytics.captureException(..., { step: 'slack_connected_check' }). A plain token-expiry 401 (or a missing-integration:read-scope 403) is expected and non-actionable, yet it showed up as a real exception, creating error-tracking noise on every stale-token poll.Changes
httpStatusOf(error)toapi.tsto extract an axios error's HTTP status without pulling axios into the screen..catch, downgrade a 401/403 to a debug log plus a lightweightslack connect check skippedbreadcrumb event. Any other error is still captured as an exception. The graceful degradation (stop polling, show the nudge) is unchanged.Why: token expiry during the poll is already handled correctly; it was only surfacing as noise in error tracking rather than indicating a broken flow.
Test plan
src/lib/__tests__/api-http-status.test.tscovershttpStatusOffor axios errors with/without a response and non-axios errors.pnpm build && pnpm test && pnpm lintall pass (0 lint errors).Created with PostHog Code from an inbox report.