Skip to content

fix(slack): don't capture transient network blips in Slack-connect poll#781

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

fix(slack): don't capture transient network blips in Slack-connect poll#781
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/slack-connect-transient-network-noise

Conversation

@posthog

@posthog posthog Bot commented Jul 1, 2026

Copy link
Copy Markdown

Problem

A wizard user hit a transient network timeout during the Slack-connect poll and it surfaced in error tracking as a messageless AggregateError.

fetchSlackConnected in src/lib/api.ts fired a bare axios.get at /api/projects/:id/integrations/ and, unlike its siblings in the same file, skipped handleApiError. When the host is unreachable, Node's net layer throws an AggregateError with an empty message (the internalConnectMultiple connect-timeout signature). The SlackConnectScreen poll's .catch then handed that raw, messageless error straight to captureException, so it landed in error tracking as an untriageable AggregateError.

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

  • Route fetchSlackConnected failures through handleApiError so the thrown error always carries a real message.
  • Add isTransientNetworkError to recognise the connect-timeout AggregateError and response-less axios errors with a known connection error code (ETIMEDOUT, ECONNREFUSED, …), flagging them via a new ApiError.isTransient.
  • Skip captureException for 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

  • New unit tests in src/lib/__tests__/api.test.ts cover transient detection, message enrichment, and that auth failures stay visible/non-transient.
  • pnpm build && pnpm test (1095 tests) and pnpm lint (0 errors) pass.

Created with PostHog Code from an inbox report.

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
@github-actions

github-actions Bot commented Jul 1, 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