fix(slack): don't capture transient network blips in Slack-connect poll#781
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(slack): don't capture transient network blips in Slack-connect poll#781posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
fetchSlackConnected fired a bare axios.get and, unlike its siblings, skipped handleApiError. On a connect timeout Node's net layer throws a messageless AggregateError, which the SlackConnectScreen poll handed straight to captureException — landing in error tracking as an untriageable AggregateError. Route the failure through handleApiError so it always carries a real message, add isTransientNetworkError to recognise connect-timeout AggregateErrors and response-less connection-code axios errors, flag them via ApiError.isTransient, and skip captureException for those in the poll's catch. The poll already degrades gracefully (stops polling, falls back to the connect nudge), so transient connectivity noise is dropped while genuine auth/permission failures stay visible. Generated-By: PostHog Code Task-Id: a81876d2-36fa-4afb-a610-c70227ba8da1
🧙 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
A wizard user hit a transient network timeout during the Slack-connect poll and it surfaced in error tracking as a messageless
AggregateError.fetchSlackConnectedinsrc/lib/api.tsfired a bareaxios.getat/api/projects/:id/integrations/and, unlike its siblings in the same file, skippedhandleApiError. When the host is unreachable, Node'snetlayer throws anAggregateErrorwith an empty message (theinternalConnectMultipleconnect-timeout signature). TheSlackConnectScreenpoll's.catchthen handed that raw, messageless error straight tocaptureException, so it landed in error tracking as an untriageableAggregateError.Nothing was broken for the user — the poll already degrades gracefully (stops polling, falls back to the connect nudge). The only real cost was low-grade error-tracking noise.
Changes
fetchSlackConnectedfailures throughhandleApiErrorso the thrown error always carries a real message.isTransientNetworkErrorto recognise the connect-timeoutAggregateErrorand response-less axios errors with a known connection error code (ETIMEDOUT,ECONNREFUSED, …), flagging them via a newApiError.isTransient.captureExceptionfor transient failures in the poll's.catch, since that path already falls back cleanly. Genuine auth/permission failures still carry a real message and are captured once.Test plan
src/lib/__tests__/api.test.tscover transient detection, message enrichment, and that auth failures stay visible/non-transient.pnpm build && pnpm test(1095 tests) andpnpm lint(0 errors) pass.Created with PostHog Code from an inbox report.