Skip to content

fix(frontend): handle transient network failures on downloadUrl path - #2902

Draft
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixfrontend-handle-transient-network-d0d09e
Draft

fix(frontend): handle transient network failures on downloadUrl path#2902
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixfrontend-handle-transient-network-d0d09e

Conversation

@posthog-eu

@posthog-eu posthog-eu Bot commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Two error-tracking issues turned out to be one thing: a transient browser network drop on the downloadUrl path, worded differently per engine.

  • Who it hurts: on the bundle page, a user clicks open/test, the network blips, and they get nothing — no download, no error toast. The TypeError threw out of downloadUrl (supabase.ts) and escaped unhandled at the bundle-page call site, skipping straight past the cannot-get-the-test- toast written for exactly this case.
  • Noise: the same family (Chrome Failed to fetch, WebKit Load failed, Firefox NetworkError when attempting to fetch resource., Edge, …) minted a fresh unhandled issue per browser dialect because nothing in before_send matched it.

Mechanism of the fix:

Change File Effect
Rethrow the raw TypeError untouched; wrap only non-TypeError causes (with cause) src/services/supabase.ts transient-network detection can still recognise the message
Catch the downloadUrl call in openVersion src/services/versions.ts failure lands in the existing cannot-get-the-test- toast instead of dead-ending
await openVersion(...) at the call site src/pages/app/[app].bundle.[bundle].vue the rejection is handled, not floated
Add anchored transient-network patterns + suppress in before_send src/services/staleAssetErrors.ts the family stops minting a new issue per engine

Note

Patterns are anchored (^(?:.*: )?…$) so only the standalone browser message (optionally wrapped as downloadUrl error: …) is suppressed — richer messages like Failed to fetch organization insights are left alone.

Test plan

  • npx vitest run tests/stale-asset-errors.unit.test.ts — extended to cover the transient-network matcher (raw + wrapped forms), the non-matches, and end-to-end suppression via shouldSuppressPostHogExceptionEvent. All pass.
  • Lint + vue-tsc typecheck clean on the touched files.

Screenshots

n/a — the observable change is that a network blip now shows the existing "cannot get the test" toast instead of silently doing nothing.

Checklist

  • My code follows the code style of this project and passes lint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce my tests.

Agent context

Not covered by open PR #2891: that adds retries to invokeCapgoApi (src/services/capgoApi.ts), but downloadUrl uses raw fetch and never goes through it, so this work does not overlap.


Created with PostHog Desktop from this inbox report.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

A transient browser network drop on the bundle page's open/test button threw
out of `downloadUrl` and escaped unhandled, so the user got no download and no
toast. The same family of fetch TypeErrors (Chrome "Failed to fetch", WebKit
"Load failed", Firefox "NetworkError when attempting to fetch resource.") also
minted a fresh error-tracking issue per browser dialect.

- Rethrow the original `TypeError` untouched in `downloadUrl` (wrap non-TypeError
  causes with `cause`) so transient-network detection can recognise the message.
- Catch the `downloadUrl` call in `openVersion` so a failure lands in the
  existing `cannot-get-the-test-` toast instead of dead-ending.
- Await `openVersion` at the bundle-page call site so the rejection is handled.
- Suppress the transient browser network family in `before_send` via anchored
  patterns that don't swallow richer messages like "Failed to fetch org insights".

Generated-By: PostHog Code
Task-Id: 03e5605b-c50f-4db4-8829-b6d17c074e2d
@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

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