fix: suppress PostHog telemetry errors behind corporate proxies#264
Merged
rhuanbarreto merged 1 commit intoMay 4, 2026
Merged
Conversation
Users behind corporate proxies with SSL inspection get ugly PostHogFetchNetworkError stack traces dumped to stderr during `archgate init`. Telemetry must never affect CLI behavior or output. Three changes: 1. Route PostHog ingest through managed proxy at n.archgate.dev instead of eu.i.posthog.com — better reputation with corporate proxies and ad-blockers. 2. Set flushInterval: 0 to disable the SDK's automatic 10s flush timer. The CLI is a short-lived process; we flush explicitly via client.shutdown() before exit. The timer was the primary source of unhandled console.error output mid-command. 3. Wrap fetch with error handling that silently catches TLS/network failures, reports them to Sentry for visibility, and returns a synthetic 200 so the SDK drains its queue without retrying into the same broken network path. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Deploying archgate-cli with
|
| Latest commit: |
8dccf51
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://56fe1630.archgate-cli.pages.dev |
| Branch Preview URL: | https://fix-posthog-telemetry-proxy.archgate-cli.pages.dev |
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.
Summary
n.archgate.devinstead ofeu.i.posthog.com— better reputation with corporate proxies and ad-blockersflushInterval: 0) — the 10s timer fires mid-command and the SDK'slogFlushError()dumps uglyPostHogFetchNetworkError/SELF_SIGNED_CERT_IN_CHAINstack traces to stderrfetchwith error handling that silently catches TLS/network failures, reports them to Sentry (source: "posthog-fetch"), and returns a synthetic 200 so the queue drains without retryingContext
A user behind a corporate proxy with SSL inspection hit this during
archgate init:The PostHog SDK's internal
logFlushError()callsconsole.error()before swallowing the error, so our existing try-catch aroundclient.shutdown()couldn't prevent the output. The auto-flush timer compounded the issue by firing independently mid-command.Test plan
bun run validatepasses (lint, typecheck, format, 690 tests, 23/23 ADR rules, build)n.archgate.devCNAME is live and resolving to PostHog proxy infrastructureposthog-fetcherrors when fetch fails (check Sentry dashboard after deploying)