Skip to content

fix(slack): don't report transient poll 504s/timeouts to error tracking#835

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/slack-poll-transient-504
Draft

fix(slack): don't report transient poll 504s/timeouts to error tracking#835
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/slack-poll-transient-504

Conversation

@posthog

@posthog posthog Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem

The Slack-connect screen polls /api/projects/:id/integrations/ to detect when a user finishes the Slack OAuth flow in their browser. The poll's .catch deliberately reports every failure to error tracking (step: 'slack_connected_check') — but that includes transient PostHog gateway timeouts (504). The loop already degrades gracefully on failure (it stops polling and falls back to the connect nudge), so a server-side blip surfaced as an exception is error-tracking noise that hurts the team, not users.

Changes

  • Add an exported isTransientApiError helper in src/lib/api.ts that recognizes gateway statuses (502/503/504), client request timeouts (ECONNABORTED/ETIMEDOUT), and no-response network drops (ERR_NETWORK).
  • Give fetchSlackConnected a short (5s) request timeout so a hung tick aborts and lets the next tick retry instead of wedging the loop.
  • In the poll's .catch, transient errors now reschedule the next poll tick quietly instead of calling captureException. Genuinely unexpected errors are still captured once and stop the loop, exactly as before.

Test plan

  • New unit test src/lib/__tests__/api-transient-error.test.ts covers the transient/non-transient classification (gateway statuses, timeouts, network drops, real HTTP errors, non-axios values).
  • pnpm build && pnpm test && pnpm lint — build passes, tests pass, lint clean on changed files.

LLM context

Authored by PostHog Code (Claude) from an inbox report about transient 504s on the Slack connectivity poll being reported to error tracking.


Created with PostHog Code from an inbox report.

The Slack-connect screen polls `/integrations/` to detect when the user
finishes OAuth. Its `.catch` captured every failure as an exception,
including transient PostHog gateway timeouts (504) — best-effort noise
that the loop already recovers from.

The poll now adds a short request timeout and classifies gateway (502/503/504),
client-timeout, and no-response network errors as transient via a new
`isTransientApiError` helper: on those it keeps polling quietly so the
next tick can recover, and only genuinely unexpected errors are captured
once (and stop the loop) as before.

Generated-By: PostHog Code
Task-Id: b1b3be80-856c-4c02-99da-2f9ce7f665c6
@github-actions

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